Give string constants generated by IRBuilder private linkage.

Fixes PR11640.

llvm-svn: 147144
This commit is contained in:
Benjamin Kramer 2011-12-22 14:22:14 +00:00
parent 4977edd33d
commit f1fd6e394d
2 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ Value *IRBuilderBase::CreateGlobalString(StringRef Str, const Twine &Name) {
Constant *StrConstant = ConstantArray::get(Context, Str, true);
Module &M = *BB->getParent()->getParent();
GlobalVariable *GV = new GlobalVariable(M, StrConstant->getType(),
true, GlobalValue::InternalLinkage,
true, GlobalValue::PrivateLinkage,
StrConstant, "", 0, false);
GV->setName(Name);
GV->setUnnamedAddr(true);

View File

@ -3,7 +3,7 @@
@str = internal constant [13 x i8] c"hello world\0A\00" ; <[13 x i8]*> [#uses=1]
@str1 = internal constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1]
; CHECK: internal unnamed_addr constant [12 x i8] c"hello world\00"
; CHECK: private unnamed_addr constant [12 x i8] c"hello world\00"
declare i32 @printf(i8*, ...)