Maybe strip off the braces immediately after detecting them? That'd let you simplify a couple of other things in the function.
On Wed, Aug 7, 2013 at 6:09 PM, David Majnemer <[email protected]>wrote: > Hi rsmith, thakis, > > Make sure we can properly generate code when the UUID has curly braces > on it, strip the curly braces at the sema layer. > > This fixes PR16813. > > http://llvm-reviews.chandlerc.com/D1319 > > Files: > lib/Sema/SemaDeclAttr.cpp > test/CodeGenCXX/microsoft-uuidof.cpp > > Index: lib/Sema/SemaDeclAttr.cpp > =================================================================== > --- lib/Sema/SemaDeclAttr.cpp > +++ lib/Sema/SemaDeclAttr.cpp > @@ -4602,7 +4602,8 @@ > } > > D->addAttr(::new (S.Context) > - UuidAttr(Attr.getRange(), S.Context, Str->getString(), > + UuidAttr(Attr.getRange(), S.Context, > + IsCurly ? StrRef.drop_front().drop_back() : StrRef, > Attr.getAttributeSpellingListIndex())); > } > > Index: test/CodeGenCXX/microsoft-uuidof.cpp > =================================================================== > --- test/CodeGenCXX/microsoft-uuidof.cpp > +++ test/CodeGenCXX/microsoft-uuidof.cpp > @@ -10,6 +10,11 @@ > > struct __declspec(uuid("12345678-1234-1234-1234-1234567890ab")) S1 { } s1; > struct __declspec(uuid("87654321-4321-4321-4321-ba0987654321")) S2 { }; > +struct __declspec(uuid("{12345678-1234-1234-1234-1234567890ac}")) Curly; > + > +// Make sure we can properly generate code when the UUID has curly braces > on it. > +GUID thing = __uuidof(Curly); > +// CHECK: @thing = global %struct._GUID zeroinitializer, align 4 > Would be good to check that we emit the right value for a braced UUID too. > // This gets initialized in a static initializer. > // CHECK: @g = global %struct._GUID zeroinitializer, align 4 >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
