[PATCH] Sema: Assertion failure during CodeGen in CodeGenModule::EmitUuidofInitializer

David Majnemer david.majnemer at gmail.com
Wed Aug 7 18:09:57 PDT 2013


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
 
 // This gets initialized in a static initializer.
 // CHECK: @g = global %struct._GUID zeroinitializer, align 4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1319.1.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130807/e1700bfe/attachment.bin>


More information about the cfe-commits mailing list