]> granicus.if.org Git - clang/commitdiff
Use private linkage to avoid symbol conflicts in corner cases like the one
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 24 Feb 2011 20:31:44 +0000 (20:31 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 24 Feb 2011 20:31:44 +0000 (20:31 +0000)
in PR9301.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126422 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp
test/CodeGen/decl.c

index 844b1e37b0a74202c40d1f9011a5e172940dced4..f4db01d2570b969b891ef515ed6122bef928da9c 100644 (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());
index 7a9971ee18127cc6b5fc7acc5dc6f48b03e2b84f..5be421623616354e42cac7a4d22dd7bb5d2e4432 100644 (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 }