This is an archive of the discontinued LLVM Phabricator instance.

Support alternate attribute spelling __enable_if__
ClosedPublic

Authored by uweigand on Jul 13 2015, 6:42 AM.

Details

Summary

Attribute names usually support an alternate spelling that uses double underscores before and after the attribute name, like e.g. attribute ((aligned)) for attribute ((aligned)). This is necessary to allow use of attributes in system headers without polluting the name space.

However, for attribute ((enable_if)) that alternate spelling does not work correctly. This is because of code in Parser::ParseGNUAttributeArgs (ParseDecl.cpp) that specifically checks for the "enable_if" spelling without allowing the alternate spelling.

Similar code in ParseDecl.cpp uses the normalizeAttrName helper to allow both spellings. This patch adds use of that helper for the "enable_if" check as well, which fixes attribute ((enable_if)).

Diff Detail

Repository
rL LLVM

Event Timeline

uweigand updated this revision to Diff 29561.Jul 13 2015, 6:42 AM
uweigand retitled this revision from to Support alternate attribute spelling __enable_if__.
uweigand updated this object.
uweigand added reviewers: aaron.ballman, rsmith.
uweigand added a subscriber: cfe-commits.
This revision was automatically updated to reflect the committed changes.