[PATCH] Sema: Assertion failure during CodeGen in CodeGenModule::EmitUuidofInitializer
Richard Smith
richard at metafoo.co.uk
Wed Aug 7 22:43:31 PDT 2013
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 <david.majnemer at gmail.com>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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130807/21ff7201/attachment.html>
More information about the cfe-commits
mailing list