summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2015-07-13 14:13:01 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2015-07-13 14:13:01 +0000
commit5ae3c7b7de2242a63d41e3c326c3600477a8fdf0 (patch)
tree6121953ebe7799519d96a01bd537d3e4d9581d2a /lib
parentc6b4ddb4d7b507e0eb0a127fb6aa9556abc01409 (diff)
downloadclang-5ae3c7b7de2242a63d41e3c326c3600477a8fdf0.tar.gz
Support alternate attribute spelling __enable_if__
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__)). Differential Revision: http://reviews.llvm.org/D11142 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/ParseDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index bc253f7f86..f46af889e2 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -365,7 +365,8 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName,
// These may refer to the function arguments, but need to be parsed early to
// participate in determining whether it's a redeclaration.
std::unique_ptr<ParseScope> PrototypeScope;
- if (AttrName->isStr("enable_if") && D && D->isFunctionDeclarator()) {
+ if (normalizeAttrName(AttrName->getName()) == "enable_if" &&
+ D && D->isFunctionDeclarator()) {
DeclaratorChunk::FunctionTypeInfo FTI = D->getFunctionTypeInfo();
PrototypeScope.reset(new ParseScope(this, Scope::FunctionPrototypeScope |
Scope::FunctionDeclarationScope |