r195579 - __declspec(uuid) is only allowed on a class according to MSDN; this makes the semantic checking consistent with what the attribute specifies in Attr.td. Also adds a test case.
Richard Smith
richard at metafoo.co.uk
Sun Nov 24 15:24:52 PST 2013
On Sun, Nov 24, 2013 at 12:58 PM, Aaron Ballman <aaron at aaronballman.com>wrote:
> Author: aaronballman
> Date: Sun Nov 24 14:58:02 2013
> New Revision: 195579
>
> URL: http://llvm.org/viewvc/llvm-project?rev=195579&view=rev
> Log:
> __declspec(uuid) is only allowed on a class according to MSDN; this makes
> the semantic checking consistent with what the attribute specifies in
> Attr.td. Also adds a test case.
>
> Modified:
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> cfe/trunk/test/Parser/MicrosoftExtensions.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195579&r1=195578&r2=195579&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sun Nov 24 14:58:02 2013
> @@ -4482,6 +4482,12 @@ static void handleUuidAttr(Sema &S, Decl
> if (!checkMicrosoftExt(S, Attr, S.LangOpts.Borland))
> return;
>
> + if (!isa<CXXRecordDecl>(D)) {
> + S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
> + << Attr.getName() << ExpectedClass;
> + return;
> + }
>
This will reject the attribute in C mode; does that match MSVC?
> +
> StringRef StrRef;
> SourceLocation LiteralLoc;
> if (!S.checkStringLiteralArgumentAttr(Attr, 0, StrRef, &LiteralLoc))
>
> Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=195579&r1=195578&r2=195579&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
> +++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Sun Nov 24 14:58:02 2013
> @@ -50,7 +50,7 @@ struct __declspec(uuid("0000000-0000-000
> struct __declspec(uuid("0000000-0000-0000-Z234-000000000047"))
> uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed
> GUID}}
> struct __declspec(uuid("000000000000-0000-1234-000000000047"))
> uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed
> GUID}}
>
> -
> +__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; //
> expected-warning {{'uuid' attribute only applies to classes}}
>
> struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
> struct_with_uuid { };
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131124/b3aaef32/attachment.html>
More information about the cfe-commits
mailing list