aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Attributes.cpp
diff options
context:
space:
mode:
authorJohn Brawn <john.brawn@arm.com>2020-03-25 10:53:30 +0000
committerJohn Brawn <john.brawn@arm.com>2020-03-25 14:33:44 +0000
commitbc3f171090f6d9f84a5d7b333bc70a1e14afffd4 (patch)
treed18ce00b2e340593a098b7e28bc866052da0a9a1 /clang/lib/Basic/Attributes.cpp
parent72b51d6f93b503be23ead4dce850b5240834bbb7 (diff)
downloadllvm-bc3f171090f6d9f84a5d7b333bc70a1e14afffd4.zip
llvm-bc3f171090f6d9f84a5d7b333bc70a1e14afffd4.tar.gz
llvm-bc3f171090f6d9f84a5d7b333bc70a1e14afffd4.tar.bz2
Don't normalise CXX11/C2X attribute names to start with ::
Currently square-bracket-style (CXX11/C2X) attribute names are normalised to start with :: if they don't have a namespace. This is a bit odd, as such names are rejected when parsing, so don't do this. Differential Revision: https://reviews.llvm.org/D76704
Diffstat (limited to 'clang/lib/Basic/Attributes.cpp')
-rw-r--r--clang/lib/Basic/Attributes.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp
index a860c9d..d479b39 100644
--- a/clang/lib/Basic/Attributes.cpp
+++ b/clang/lib/Basic/Attributes.cpp
@@ -85,12 +85,12 @@ static SmallString<64> normalizeName(const IdentifierInfo *Name,
StringRef ScopeName = normalizeAttrScopeName(Scope, SyntaxUsed);
StringRef AttrName = normalizeAttrName(Name, ScopeName, SyntaxUsed);
- // Ensure that in the case of C++11 attributes, we look for '::foo' if it is
- // unscoped.
SmallString<64> FullName = ScopeName;
- if (Scope || SyntaxUsed == AttributeCommonInfo::AS_CXX11 ||
- SyntaxUsed == AttributeCommonInfo::AS_C2x)
+ if (!ScopeName.empty()) {
+ assert(SyntaxUsed == AttributeCommonInfo::AS_CXX11 ||
+ SyntaxUsed == AttributeCommonInfo::AS_C2X);
FullName += "::";
+ }
FullName += AttrName;
return FullName;