summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2018-10-24 12:26:23 +0000
committerAaron Ballman <aaron@aaronballman.com>2018-10-24 12:26:23 +0000
commitad672ffb643c646ca7680c765342bd58252ecdbe (patch)
tree983949541e2d1345350ca5f6f01833b6db7a09da /clang/lib/Sema/SemaDeclAttr.cpp
parentc4a995c8e05bd63932677ee30e4f4cfd6623eaff (diff)
downloadbcm5719-llvm-ad672ffb643c646ca7680c765342bd58252ecdbe.tar.gz
bcm5719-llvm-ad672ffb643c646ca7680c765342bd58252ecdbe.zip
Support accepting __gnu__ as a scoped attribute namespace that aliases to gnu.
This is useful in libstdc++ to avoid clashes with identifiers in the user's namespace. llvm-svn: 345132
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index c0fb3356bae..a0faf840958 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -5831,16 +5831,14 @@ static void handleDeprecatedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (AL.isDeclspecAttribute() || AL.isCXX11Attribute())
checkAttributeAtMostNumArgs(S, AL, 1);
else if (AL.isArgExpr(1) && AL.getArgAsExpr(1) &&
- !S.checkStringLiteralArgumentAttr(AL, 1, Replacement))
- return;
-
- if (!S.getLangOpts().CPlusPlus14)
- if (AL.isCXX11Attribute() &&
- !(AL.hasScope() && AL.getScopeName()->isStr("gnu")))
- S.Diag(AL.getLoc(), diag::ext_cxx14_attr) << AL;
-
- D->addAttr(::new (S.Context)
- DeprecatedAttr(AL.getRange(), S.Context, Str, Replacement,
+ !S.checkStringLiteralArgumentAttr(AL, 1, Replacement))
+ return;
+
+ if (!S.getLangOpts().CPlusPlus14 && AL.isCXX11Attribute() && !AL.isGNUScope())
+ S.Diag(AL.getLoc(), diag::ext_cxx14_attr) << AL;
+
+ D->addAttr(::new (S.Context)
+ DeprecatedAttr(AL.getRange(), S.Context, Str, Replacement,
AL.getAttributeSpellingListIndex()));
}
OpenPOWER on IntegriCloud