diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2013-11-24 21:35:16 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2013-11-24 21:35:16 +0000 |
commit | df8fe4c91cf2ba8a2ede933aab0f138b7d2fd673 (patch) | |
tree | 7b6954a946b64e8fefac0ffd904cec99dd811efa /clang/lib | |
parent | 60e705e648af7fb3c962c68edc40468a6439be8a (diff) | |
download | bcm5719-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.cpp | 14 |
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; |