summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Attributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Basic/Attributes.cpp')
-rw-r--r--clang/lib/Basic/Attributes.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp
index 1c84d0779e1..9a8eb3d932c 100644
--- a/clang/lib/Basic/Attributes.cpp
+++ b/clang/lib/Basic/Attributes.cpp
@@ -9,16 +9,18 @@ int clang::hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope,
const LangOptions &LangOpts) {
StringRef Name = Attr->getName();
// Normalize the attribute name, __foo__ becomes foo.
- if (Name.size() >= 4 && Name.startswith("__") && Name.endswith("__"))
- Name = Name.substr(2, Name.size() - 4);
-
- // Normalize the scope name, but only for gnu attributes.
- StringRef ScopeName = Scope ? Scope->getName() : "";
- if (ScopeName == "__gnu__")
- ScopeName = ScopeName.slice(2, ScopeName.size() - 2);
-
-#include "clang/Basic/AttrHasAttributeImpl.inc"
-
+ 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;
}
OpenPOWER on IntegriCloud