<div dir="ltr">Never mind; your next patch answers this question =)</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 24, 2013 at 3:24 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="im">On Sun, Nov 24, 2013 at 12:58 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: aaronballman<br>
Date: Sun Nov 24 14:58:02 2013<br>
New Revision: 195579<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=195579&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=195579&view=rev</a><br>
Log:<br>
__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.<br>
<br>
Modified:<br>
cfe/trunk/lib/Sema/SemaDeclAttr.cpp<br>
cfe/trunk/test/Parser/MicrosoftExtensions.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195579&r1=195578&r2=195579&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195579&r1=195578&r2=195579&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sun Nov 24 14:58:02 2013<br>
@@ -4482,6 +4482,12 @@ static void handleUuidAttr(Sema &S, Decl<br>
if (!checkMicrosoftExt(S, Attr, S.LangOpts.Borland))<br>
return;<br>
<br>
+ if (!isa<CXXRecordDecl>(D)) {<br>
+ S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)<br>
+ << Attr.getName() << ExpectedClass;<br>
+ return;<br>
+ }<br></blockquote><div><br></div></div><div>This will reject the attribute in C mode; does that match MSVC?</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+<br>
StringRef StrRef;<br>
SourceLocation LiteralLoc;<br>
if (!S.checkStringLiteralArgumentAttr(Attr, 0, StrRef, &LiteralLoc))<br>
<br>
Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=195579&r1=195578&r2=195579&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=195579&r1=195578&r2=195579&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)<br>
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Sun Nov 24 14:58:02 2013<br>
@@ -50,7 +50,7 @@ struct __declspec(uuid("0000000-0000-000<br>
struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed GUID}}<br>
struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}}<br>
<br>
-<br>
+__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; // expected-warning {{'uuid' attribute only applies to classes}}<br>
<br>
struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))<br>
struct_with_uuid { };<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div><br></div></div>
</blockquote></div><br></div>