summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2015-02-16 22:27:01 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2015-02-16 22:27:01 +0000
commitf931a3896ed409b890ee573a947af1b8db9109af (patch)
tree3d1bc5c7282605ff573571a06921c66c6c5151b0 /clang/lib/Sema/SemaDeclAttr.cpp
parent9c8d77794bae4af323898c7f22cc9c09391b9a47 (diff)
downloadbcm5719-llvm-f931a3896ed409b890ee573a947af1b8db9109af.tar.gz
bcm5719-llvm-f931a3896ed409b890ee573a947af1b8db9109af.zip
Sema: diagnose use of unscoped deprecated prior to C++14
The deprecated attribute was adopted as part of the C++14, however, there is a GNU version available in C++11. When using C++ earlier than C++14, diagnose the use of the attribute without the GNU scope, but only when using the generalised attribute syntax. llvm-svn: 229447
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 2f92d3dbb2d..42cfd9afa01 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -4254,6 +4254,13 @@ static void handleDeprecatedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
return;
}
}
+
+ if (!S.getLangOpts().CPlusPlus14)
+ if (Attr.isCXX11Attribute() &&
+ !(Attr.hasScope() && Attr.getScopeName()->isStr("gnu")))
+ S.Diag(Attr.getLoc(), diag::ext_use_of_attribute_is_a_cxx14_extension)
+ << Attr.getName()->getNameStart();
+
handleAttrWithMessage<DeprecatedAttr>(S, D, Attr);
}
OpenPOWER on IntegriCloud