r188055 - Revert "[-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper section"

David Majnemer david.majnemer at gmail.com
Thu Aug 8 22:56:24 PDT 2013


Author: majnemer
Date: Fri Aug  9 00:56:24 2013
New Revision: 188055

URL: http://llvm.org/viewvc/llvm-project?rev=188055&view=rev
Log:
Revert "[-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper section"

This commit reverts r188053.

It is breaking the build bots.

Modified:
    cfe/trunk/lib/AST/MicrosoftMangle.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/CodeGenCXX/microsoft-uuidof.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=188055&r1=188054&r2=188055&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Aug  9 00:56:24 2013
@@ -317,7 +317,10 @@ void MicrosoftCXXNameMangler::mangleVari
   // mangled as 'QAHA' instead of 'PAHB', for example.
   TypeLoc TL = VD->getTypeSourceInfo()->getTypeLoc();
   QualType Ty = TL.getType();
-  if (const ArrayType *AT = getASTContext().getAsArrayType(Ty)) {
+  if (Ty->isPointerType() || Ty->isReferenceType()) {
+    mangleType(Ty, TL.getSourceRange(), QMM_Drop);
+    mangleQualifiers(Ty->getPointeeType().getQualifiers(), false);
+  } else if (const ArrayType *AT = getASTContext().getAsArrayType(Ty)) {
     // Global arrays are funny, too.
     mangleDecayedArrayType(AT, true);
     if (AT->getElementType()->isArrayType())

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=188055&r1=188054&r2=188055&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Aug  9 00:56:24 2013
@@ -1059,8 +1059,7 @@ llvm::Constant *CodeGenModule::GetAddrOf
     else
       Uuid = "00000000-0000-0000-0000-000000000000";
   }
-  std::string Name = "_GUID_" + Uuid.lower();
-  std::replace(Name.begin(), Name.end(), '-', '_');
+  std::string Name = "__uuid_" + Uuid.str();
 
   // Look for an existing global.
   if (llvm::GlobalVariable *GV = getModule().getNamedGlobal(Name))
@@ -1083,7 +1082,7 @@ llvm::Constant *CodeGenModule::GetAddrOf
   }
 
   llvm::GlobalVariable *GV = new llvm::GlobalVariable(getModule(), GuidType,
-      /*isConstant=*/true, llvm::GlobalValue::ExternalLinkage, Init, Name);
+      /*isConstant=*/true, llvm::GlobalValue::PrivateLinkage, Init, Name);
   GV->setUnnamedAddr(true);
   return GV;
 }

Modified: cfe/trunk/test/CodeGenCXX/microsoft-uuidof.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-uuidof.cpp?rev=188055&r1=188054&r2=188055&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-uuidof.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-uuidof.cpp Fri Aug  9 00:56:24 2013
@@ -8,7 +8,7 @@ typedef struct _GUID
     unsigned char  Data4[8];
 } GUID;
 
-struct __declspec(uuid("12345678-1234-1234-1234-1234567890aB")) S1 { } s1;
+struct __declspec(uuid("12345678-1234-1234-1234-1234567890ab")) S1 { } s1;
 struct __declspec(uuid("87654321-4321-4321-4321-ba0987654321")) S2 { };
 
 // This gets initialized in a static initializer.
@@ -16,23 +16,23 @@ struct __declspec(uuid("87654321-4321-43
 GUID g = __uuidof(S1);
 
 // First global use of __uuidof(S1) forces the creation of the global.
-// CHECK: @_GUID_12345678_1234_1234_1234_1234567890ab = unnamed_addr constant %struct._GUID { i32 305419896, i16 4660, i16 4660, [8 x i8] c"\124\124Vx\90\AB" }
-// CHECK: @gr = constant %struct._GUID* @_GUID_12345678_1234_1234_1234_1234567890ab, align 4
+// CHECK: @__uuid_12345678-1234-1234-1234-1234567890ab = private unnamed_addr constant %struct._GUID { i32 305419896, i16 4660, i16 4660, [8 x i8] c"\124\124Vx\90\AB" }
+// CHECK: @gr = constant %struct._GUID* @__uuid_12345678-1234-1234-1234-1234567890ab, align 4
 const GUID& gr = __uuidof(S1);
 
-// CHECK: @gp = global %struct._GUID* @_GUID_12345678_1234_1234_1234_1234567890ab, align 4
+// CHECK: @gp = global %struct._GUID* @__uuid_12345678-1234-1234-1234-1234567890ab, align 4
 const GUID* gp = &__uuidof(S1);
 
 // Special case: _uuidof(0)
-// CHECK: @zeroiid = constant %struct._GUID* @_GUID_00000000_0000_0000_0000_000000000000, align 4
+// CHECK: @zeroiid = constant %struct._GUID* @__uuid_00000000-0000-0000-0000-000000000000, align 4
 const GUID& zeroiid = __uuidof(0);
 
 // __uuidof(S2) hasn't been used globally yet, so it's emitted when it's used
 // in a function and is emitted at the end of the globals section.
-// CHECK: @_GUID_87654321_4321_4321_4321_ba0987654321 = unnamed_addr constant %struct._GUID { i32 -2023406815, i16 17185, i16 17185, [8 x i8] c"C!\BA\09\87eC!" }
+// CHECK: @__uuid_87654321-4321-4321-4321-ba0987654321 = private unnamed_addr constant %struct._GUID { i32 -2023406815, i16 17185, i16 17185, [8 x i8] c"C!\BA\09\87eC!" }
 
 // The static initializer for g.
-// CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast (%struct._GUID* @g to i8*), i8* bitcast (%struct._GUID* @_GUID_12345678_1234_1234_1234_1234567890ab to i8*), i32 16, i32 4, i1 false)
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast (%struct._GUID* @g to i8*), i8* bitcast (%struct._GUID* @__uuid_12345678-1234-1234-1234-1234567890ab to i8*), i32 16, i32 4, i1 false)
 
 void fun() {
   // CHECK: %s1_1 = alloca %struct._GUID, align 4
@@ -40,15 +40,15 @@ void fun() {
   // CHECK: %s1_3 = alloca %struct._GUID, align 4
 
   // CHECK: [[U1:%.+]] = bitcast %struct._GUID* %s1_1 to i8*
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[U1]], i8* bitcast (%struct._GUID* @_GUID_12345678_1234_1234_1234_1234567890ab to i8*), i32 16, i32 4, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[U1]], i8* bitcast (%struct._GUID* @__uuid_12345678-1234-1234-1234-1234567890ab to i8*), i32 16, i32 4, i1 false)
   GUID s1_1 = __uuidof(S1);
 
   // CHECK: [[U2:%.+]] = bitcast %struct._GUID* %s1_2 to i8*
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[U2]], i8* bitcast (%struct._GUID* @_GUID_12345678_1234_1234_1234_1234567890ab to i8*), i32 16, i32 4, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[U2]], i8* bitcast (%struct._GUID* @__uuid_12345678-1234-1234-1234-1234567890ab to i8*), i32 16, i32 4, i1 false)
   GUID s1_2 = __uuidof(S1);
 
   // CHECK: [[U3:%.+]] = bitcast %struct._GUID* %s1_3 to i8*
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[U3]], i8* bitcast (%struct._GUID* @_GUID_12345678_1234_1234_1234_1234567890ab to i8*), i32 16, i32 4, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[U3]], i8* bitcast (%struct._GUID* @__uuid_12345678-1234-1234-1234-1234567890ab to i8*), i32 16, i32 4, i1 false)
   GUID s1_3 = __uuidof(s1);
 }
 
@@ -61,12 +61,12 @@ void gun() {
   GUID s2_1 = __uuidof(S2);
   GUID s2_2 = __uuidof(S2);
 
-  // CHECK: store %struct._GUID* @_GUID_87654321_4321_4321_4321_ba0987654321, %struct._GUID** %r, align 4
+  // CHECK: store %struct._GUID* @__uuid_87654321-4321-4321-4321-ba0987654321, %struct._GUID** %r, align 4
   const GUID& r = __uuidof(S2);
-  // CHECK: store %struct._GUID* @_GUID_87654321_4321_4321_4321_ba0987654321, %struct._GUID** %p, align 4
+  // CHECK: store %struct._GUID* @__uuid_87654321-4321-4321-4321-ba0987654321, %struct._GUID** %p, align 4
   const GUID* p = &__uuidof(S2);
 
   // Special case _uuidof(0), local scope version.
-  // CHECK: store %struct._GUID* @_GUID_00000000_0000_0000_0000_000000000000, %struct._GUID** %zeroiid, align 4
+  // CHECK: store %struct._GUID* @__uuid_00000000-0000-0000-0000-000000000000, %struct._GUID** %zeroiid, align 4
   const GUID& zeroiid = __uuidof(0);
 }





More information about the cfe-commits mailing list