[cfe-commits] r123531 - in /cfe/trunk: lib/CodeGen/CGVTT.cpp lib/CodeGen/CGVTables.cpp test/CodeGenCXX/visibility.cpp test/CodeGenCXX/vtable-linkage.cpp

Rafael Espindola rafael.espindola at gmail.com
Sat Jan 15 00:23:14 PST 2011


Author: rafael
Date: Sat Jan 15 02:23:14 2011
New Revision: 123531

URL: http://llvm.org/viewvc/llvm-project?rev=123531&view=rev
Log:
Also set unnamed_addr on declarations.

Modified:
    cfe/trunk/lib/CodeGen/CGVTT.cpp
    cfe/trunk/lib/CodeGen/CGVTables.cpp
    cfe/trunk/test/CodeGenCXX/visibility.cpp
    cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=123531&r1=123530&r2=123531&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Sat Jan 15 02:23:14 2011
@@ -399,8 +399,7 @@
     GV = new llvm::GlobalVariable(CGM.getModule(), Type, /*isConstant=*/true, 
                                   Linkage, Init, Name);
     CGM.setGlobalVisibility(GV, RD, /*ForDefinition*/ GenerateDefinition);
-    if (GenerateDefinition)
-      GV->setUnnamedAddr(true);
+    GV->setUnnamedAddr(true);
     
     if (OldGV) {
       GV->takeName(OldGV);

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=123531&r1=123530&r2=123531&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Sat Jan 15 02:23:14 2011
@@ -2982,6 +2982,7 @@
   llvm::GlobalVariable *GV =
     GetGlobalVariable(CGM.getModule(), Name, ArrayType,
                       llvm::GlobalValue::ExternalLinkage);
+  GV->setUnnamedAddr(true);
   return GV;
 }
 
@@ -3073,7 +3074,6 @@
   }
 
   VTable = GetAddrOfVTable(RD);
-  VTable->setUnnamedAddr(true);
   EmitVTableDefinition(VTable, Linkage, RD);
 
   GenerateVTT(Linkage, /*GenerateDefinition=*/true, RD);

Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=123531&r1=123530&r2=123531&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Sat Jan 15 02:23:14 2011
@@ -26,8 +26,8 @@
 // CHECK: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr global i64
 // CHECK-HIDDEN: @_ZZN6Test193fooIiEEvvE1a = linkonce_odr hidden global
 // CHECK-HIDDEN: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr hidden global i64
-// CHECK-HIDDEN: @_ZTTN6Test161AIcEE = external constant
-// CHECK-HIDDEN: @_ZTVN6Test161AIcEE = external constant
+// CHECK-HIDDEN: @_ZTTN6Test161AIcEE = external unnamed_addr constant
+// CHECK-HIDDEN: @_ZTVN6Test161AIcEE = external unnamed_addr constant
 // CHECK: @_ZTVN5Test63fooE = weak_odr hidden unnamed_addr constant 
 
 namespace Test1 {

Modified: cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp?rev=123531&r1=123530&r2=123531&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-linkage.cpp Sat Jan 15 02:23:14 2011
@@ -99,7 +99,7 @@
 
 // B has a key function that is not defined in this translation unit so its vtable
 // has external linkage.
-// CHECK-1: @_ZTV1B = external constant
+// CHECK-1: @_ZTV1B = external unnamed_addr constant
 
 // C has no key function, so its vtable should have weak_odr linkage
 // and hidden visibility (rdar://problem/7523229).
@@ -157,12 +157,12 @@
 
 // F<int> is an explicit template instantiation declaration without a
 // key function, so its vtable should have external linkage.
-// CHECK-9: @_ZTV1FIiE = external constant
+// CHECK-9: @_ZTV1FIiE = external unnamed_addr constant
 
 // E<int> is an explicit template instantiation declaration. It has a
 // key function that is not instantiated, so we should only reference
 // its vtable, not define it.
-// CHECK-10: @_ZTV1EIiE = external constant
+// CHECK-10: @_ZTV1EIiE = external unnamed_addr constant
 
 // The anonymous struct for e has no linkage, so the vtable should have
 // internal linkage.





More information about the cfe-commits mailing list