summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2013-11-24 21:35:16 +0000
committerAaron Ballman <aaron@aaronballman.com>2013-11-24 21:35:16 +0000
commitdf8fe4c91cf2ba8a2ede933aab0f138b7d2fd673 (patch)
tree7b6954a946b64e8fefac0ffd904cec99dd811efa /clang/lib
parent60e705e648af7fb3c962c68edc40468a6439be8a (diff)
downloadbcm5719-llvm-df8fe4c91cf2ba8a2ede933aab0f138b7d2fd673.tar.gz
bcm5719-llvm-df8fe4c91cf2ba8a2ede933aab0f138b7d2fd673.zip
__declspec(uuid) is only supported for C++ code according to MSDN (as well as behaviorally in MSVC). This adds a generic diagnostic that we use for uuid, and can use for some other attributes as well, and adds a testcase.
llvm-svn: 195580
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 1f786471537..4a8b5289317 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -61,6 +61,14 @@ enum AttributeDeclKind {
ExpectedType
};
+namespace AttributeLangSupport {
+ enum {
+ C,
+ Cpp,
+ ObjC
+ };
+}
+
//===----------------------------------------------------------------------===//
// Helper functions
//===----------------------------------------------------------------------===//
@@ -4479,6 +4487,12 @@ static bool checkMicrosoftExt(Sema &S, const AttributeList &Attr,
}
static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+ if (!S.LangOpts.CPlusPlus) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_not_supported_in_lang)
+ << Attr.getName() << AttributeLangSupport::C;
+ return;
+ }
+
if (!checkMicrosoftExt(S, Attr, S.LangOpts.Borland))
return;
OpenPOWER on IntegriCloud