Use private linkage to avoid symbol conflicts in corner cases like the one

in PR9301.

llvm-svn: 126422
This commit is contained in:
Rafael Espindola 2011-02-24 20:31:44 +00:00
parent 601a11edd4
commit eb4fd01f7a
2 changed files with 2 additions and 2 deletions

View File

@ -642,7 +642,7 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
// candidate nor a __block variable, emit it as a global instead.
if (CGM.getCodeGenOpts().MergeAllConstants && Ty.isConstQualified() &&
!NRVO && !isByRef) {
EmitStaticVarDecl(D, llvm::GlobalValue::InternalLinkage);
EmitStaticVarDecl(D, llvm::GlobalValue::PrivateLinkage);
emission.Address = 0; // signal this condition to later callbacks
assert(emission.wasEmittedAsGlobal());

View File

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -w -emit-llvm < %s | FileCheck %s
// CHECK: @test1.x = internal constant [12 x i32] [i32 1
// CHECK: @test1.x = private constant [12 x i32] [i32 1
// CHECK: @test2.x = internal constant [13 x i32] [i32 1,
// CHECK: @test5w = global %0 { i32 2, [4 x i8] undef }
// CHECK: @test5y = global %union.test5u { double 7.300000e+0{{[0]*}}1 }