merge strings created by

const NSConstantString *appKey =  @"MyApp";

llvm-svn: 123680
This commit is contained in:
Rafael Espindola 2011-01-17 22:11:21 +00:00
parent 6760a51739
commit de089d462c
2 changed files with 7 additions and 0 deletions

View File

@ -1681,6 +1681,7 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) {
llvm::GlobalVariable *GV = llvm::GlobalVariable *GV =
new llvm::GlobalVariable(getModule(), C->getType(), isConstant, Linkage, C, new llvm::GlobalVariable(getModule(), C->getType(), isConstant, Linkage, C,
".str"); ".str");
GV->setUnnamedAddr(true);
if (isUTF16) { if (isUTF16) {
CharUnits Align = getContext().getTypeAlignInChars(getContext().ShortTy); CharUnits Align = getContext().getTypeAlignInChars(getContext().ShortTy);
GV->setAlignment(Align.getQuantity()); GV->setAlignment(Align.getQuantity());

View File

@ -31,3 +31,9 @@ int main() {
// CHECK-FRAGILE: @_NSConstantStringClassReference = external global // CHECK-FRAGILE: @_NSConstantStringClassReference = external global
// CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = 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"