[cfe-commits] r123680 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGenObjC/ns-constant-strings.m
Rafael Espindola
rafael.espindola at gmail.com
Mon Jan 17 14:11:21 PST 2011
Author: rafael
Date: Mon Jan 17 16:11:21 2011
New Revision: 123680
URL: http://llvm.org/viewvc/llvm-project?rev=123680&view=rev
Log:
merge strings created by
const NSConstantString *appKey = @"MyApp";
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenObjC/ns-constant-strings.m
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=123680&r1=123679&r2=123680&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jan 17 16:11:21 2011
@@ -1681,6 +1681,7 @@
llvm::GlobalVariable *GV =
new llvm::GlobalVariable(getModule(), C->getType(), isConstant, Linkage, C,
".str");
+ GV->setUnnamedAddr(true);
if (isUTF16) {
CharUnits Align = getContext().getTypeAlignInChars(getContext().ShortTy);
GV->setAlignment(Align.getQuantity());
Modified: cfe/trunk/test/CodeGenObjC/ns-constant-strings.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/ns-constant-strings.m?rev=123680&r1=123679&r2=123680&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/ns-constant-strings.m (original)
+++ cfe/trunk/test/CodeGenObjC/ns-constant-strings.m Mon Jan 17 16:11:21 2011
@@ -31,3 +31,9 @@
// CHECK-FRAGILE: @_NSConstantStringClassReference = external global
// CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = external global
+
+// CHECK-FRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00"
+// CHECK-FRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00"
+
+// CHECK-NONFRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00"
+// CHECK-NONFRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00"
More information about the cfe-commits
mailing list