summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2019-08-15 18:35:44 +0000
committerAaron Ballman <aaron@aaronballman.com>2019-08-15 18:35:44 +0000
commit2ed4573e8f8619dc67647256ac070bf91f461392 (patch)
tree4ebec17cb673b7f46a82af3d2c0af5a72885a1ec /clang/lib
parent00782a4b68c71b9fb80b403b13f9ec67f07a87a4 (diff)
downloadbcm5719-llvm-2ed4573e8f8619dc67647256ac070bf91f461392.tar.gz
bcm5719-llvm-2ed4573e8f8619dc67647256ac070bf91f461392.zip
Allow standards-based attributes to have leading and trailing underscores.
This gives library implementers a way to use standards-based attributes that do not conflict with user-defined macros of the same name. Attributes in C2x require this behavior normatively (C2x 6.7.11p4), but there's no reason to not have the same behavior in C++, especially given that such attributes may be used by a C library consumed by a C++ compilation. llvm-svn: 369033
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/ParsedAttr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/ParsedAttr.cpp b/clang/lib/Sema/ParsedAttr.cpp
index 5c04443460b..6c103081c60 100644
--- a/clang/lib/Sema/ParsedAttr.cpp
+++ b/clang/lib/Sema/ParsedAttr.cpp
@@ -125,7 +125,8 @@ static StringRef normalizeAttrName(StringRef AttrName,
SyntaxUsed == ParsedAttr::AS_GNU ||
((SyntaxUsed == ParsedAttr::AS_CXX11 ||
SyntaxUsed == ParsedAttr::AS_C2x) &&
- (NormalizedScopeName == "gnu" || NormalizedScopeName == "clang"));
+ (NormalizedScopeName.empty() || NormalizedScopeName == "gnu" ||
+ NormalizedScopeName == "clang"));
if (ShouldNormalize && AttrName.size() >= 4 && AttrName.startswith("__") &&
AttrName.endswith("__"))
AttrName = AttrName.slice(2, AttrName.size() - 2);
OpenPOWER on IntegriCloud