[cfe-commits] r126422 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGen/decl.c

Rafael Espindola rafael.espindola at gmail.com
Thu Feb 24 12:31:44 PST 2011


Author: rafael
Date: Thu Feb 24 14:31:44 2011
New Revision: 126422

URL: http://llvm.org/viewvc/llvm-project?rev=126422&view=rev
Log:
Use private linkage to avoid symbol conflicts in corner cases like the one
in PR9301.

Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/test/CodeGen/decl.c

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=126422&r1=126421&r2=126422&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Thu Feb 24 14:31:44 2011
@@ -642,7 +642,7 @@
         // 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());

Modified: cfe/trunk/test/CodeGen/decl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/decl.c?rev=126422&r1=126421&r2=126422&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/decl.c (original)
+++ cfe/trunk/test/CodeGen/decl.c Thu Feb 24 14:31:44 2011
@@ -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 }





More information about the cfe-commits mailing list