Maybe strip off the braces immediately after detecting them? That'd let you simplify a couple of other things in the function.<br><br><div class="gmail_quote">On Wed, Aug 7, 2013 at 6:09 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi rsmith, thakis,<br>
<br>
Make sure we can properly generate code when the UUID has curly braces<br>
on it, strip the curly braces at the sema layer.<br>
<br>
This fixes PR16813.<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D1319" target="_blank">http://llvm-reviews.chandlerc.com/D1319</a><br>
<br>
Files:<br>
lib/Sema/SemaDeclAttr.cpp<br>
test/CodeGenCXX/microsoft-uuidof.cpp<br>
<br>
Index: lib/Sema/SemaDeclAttr.cpp<br>
===================================================================<br>
--- lib/Sema/SemaDeclAttr.cpp<br>
+++ lib/Sema/SemaDeclAttr.cpp<br>
@@ -4602,7 +4602,8 @@<br>
}<br>
<br>
D->addAttr(::new (S.Context)<br>
- UuidAttr(Attr.getRange(), S.Context, Str->getString(),<br>
+ UuidAttr(Attr.getRange(), S.Context,<br>
+ IsCurly ? StrRef.drop_front().drop_back() : StrRef,<br>
Attr.getAttributeSpellingListIndex()));<br>
}<br>
<br>
Index: test/CodeGenCXX/microsoft-uuidof.cpp<br>
===================================================================<br>
--- test/CodeGenCXX/microsoft-uuidof.cpp<br>
+++ test/CodeGenCXX/microsoft-uuidof.cpp<br>
@@ -10,6 +10,11 @@<br>
<br>
struct __declspec(uuid("12345678-1234-1234-1234-1234567890ab")) S1 { } s1;<br>
struct __declspec(uuid("87654321-4321-4321-4321-ba0987654321")) S2 { };<br>
+struct __declspec(uuid("{12345678-1234-1234-1234-1234567890ac}")) Curly;<br>
+<br>
+// Make sure we can properly generate code when the UUID has curly braces on it.<br>
+GUID thing = __uuidof(Curly);<br>
+// CHECK: @thing = global %struct._GUID zeroinitializer, align 4<br></blockquote><div><br></div><div>Would be good to check that we emit the right value for a braced UUID too.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
// This gets initialized in a static initializer.<br>
// CHECK: @g = global %struct._GUID zeroinitializer, align 4<br>
</blockquote></div><br>