summaryrefslogtreecommitdiff
path: root/lib/Basic/Attributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Basic/Attributes.cpp')
-rw-r--r--lib/Basic/Attributes.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Basic/Attributes.cpp b/lib/Basic/Attributes.cpp
index b7570d03c85ae..9a8eb3d932cc6 100644
--- a/lib/Basic/Attributes.cpp
+++ b/lib/Basic/Attributes.cpp
@@ -12,9 +12,16 @@ int clang::hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope,
if (Name.size() >= 4 && Name.startswith("__") && Name.endswith("__"))
Name = Name.substr(2, Name.size() - 4);
+ // Normalize the scope name, but only for gnu and clang attributes.
+ StringRef ScopeName = Scope ? Scope->getName() : "";
+ if (ScopeName == "__gnu__")
+ ScopeName = "gnu";
+ else if (ScopeName == "_Clang")
+ ScopeName = "clang";
+
#include "clang/Basic/AttrHasAttributeImpl.inc"
- return 0;
+ return 0;
}
const char *attr::getSubjectMatchRuleSpelling(attr::SubjectMatchRule Rule) {