aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-08-24 00:33:55 +0000
committerEric Christopher <echristo@apple.com>2011-08-24 00:33:55 +0000
commit736a9c211c065784f7a7889ade55aa569a89520e (patch)
tree6d848699d1fd6d5931fb47d5744e1b959c55756d
parent6cf0ed062fb7ff3def3b627bab8ca275a549579e (diff)
Make constant aggregate constant initializers private linkage.
After talking with John making this the case for all of these is the right way to go. Fixes rdar://9804564 and PR10414 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138418 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGDecl.cpp2
-rw-r--r--test/CodeGen/2005-02-27-MarkGlobalConstant.c1
-rw-r--r--test/CodeGen/decl.c8
-rw-r--r--test/CodeGen/string-literal-short-wstring.c2
-rw-r--r--test/CodeGen/string-literal.c8
5 files changed, 10 insertions, 11 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 6d1e9b03ab..0f6ceedb25 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -982,7 +982,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
std::string Name = GetStaticDeclName(*this, D, ".");
llvm::GlobalVariable *GV =
new llvm::GlobalVariable(CGM.getModule(), constant->getType(), true,
- llvm::GlobalValue::InternalLinkage,
+ llvm::GlobalValue::PrivateLinkage,
constant, Name, 0, false, 0);
GV->setAlignment(alignment.getQuantity());
GV->setUnnamedAddr(true);
diff --git a/test/CodeGen/2005-02-27-MarkGlobalConstant.c b/test/CodeGen/2005-02-27-MarkGlobalConstant.c
index adcb6ebee7..dc2cdbfa72 100644
--- a/test/CodeGen/2005-02-27-MarkGlobalConstant.c
+++ b/test/CodeGen/2005-02-27-MarkGlobalConstant.c
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
-// XFAIL: *
// PR10414
// The synthetic global made by the CFE for big initializer should be marked
diff --git a/test/CodeGen/decl.c b/test/CodeGen/decl.c
index 21b75797f0..2065e3364b 100644
--- a/test/CodeGen/decl.c
+++ b/test/CodeGen/decl.c
@@ -1,11 +1,11 @@
// RUN: %clang_cc1 -w -emit-llvm < %s | FileCheck %s
// CHECK: @test1.x = internal constant [12 x i32] [i32 1
-// CHECK: @test2.x = internal unnamed_addr constant [13 x i32] [i32 1,
+// CHECK: @test2.x = private unnamed_addr constant [13 x i32] [i32 1,
// CHECK: @test5w = global { i32, [4 x i8] } { i32 2, [4 x i8] undef }
// CHECK: @test5y = global { double } { double 7.300000e+0{{[0]*}}1 }
-// CHECK: @test6.x = internal unnamed_addr constant %struct.SelectDest { i8 1, i8 2, i32 3, i32 0 }
+// CHECK: @test6.x = private unnamed_addr constant %struct.SelectDest { i8 1, i8 2, i32 3, i32 0 }
// CHECK: @test7 = global [2 x %struct.test7s] [%struct.test7s { i32 1, i32 2 }, %struct.test7s { i32 4, i32 0 }]
@@ -24,7 +24,7 @@ void test2() {
// This should codegen as a "@test2.x" global + memcpy.
int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23, 24 };
foo(x);
-
+
// CHECK: @test2()
// CHECK: %x = alloca [13 x i32]
// CHECK: call void @llvm.memcpy
@@ -36,7 +36,7 @@ void test3() {
// This should codegen as a memset.
int x[100] = { 0 };
foo(x);
-
+
// CHECK: @test3()
// CHECK: %x = alloca [100 x i32]
// CHECK: call void @llvm.memset
diff --git a/test/CodeGen/string-literal-short-wstring.c b/test/CodeGen/string-literal-short-wstring.c
index ce2990492a..770c3d4268 100644
--- a/test/CodeGen/string-literal-short-wstring.c
+++ b/test/CodeGen/string-literal-short-wstring.c
@@ -3,7 +3,7 @@
int main() {
// This should convert to utf8.
- // CHECK: internal unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
+ // CHECK: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
char b[10] = "\u1120\u0220\U00102030";
// CHECK: private unnamed_addr constant [6 x i8] c"A\00B\00\00\00"
diff --git a/test/CodeGen/string-literal.c b/test/CodeGen/string-literal.c
index c965494367..ce19d29078 100644
--- a/test/CodeGen/string-literal.c
+++ b/test/CodeGen/string-literal.c
@@ -5,13 +5,13 @@
#include <stddef.h>
int main() {
- // CHECK-C: internal unnamed_addr constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1
- // CHECK-CPP0X: internal unnamed_addr constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1
+ // CHECK-C: private unnamed_addr constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1
+ // CHECK-CPP0X: private unnamed_addr constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1
char a[10] = "abc";
// This should convert to utf8.
- // CHECK-C: internal unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
- // CHECK-CPP0X: internal unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
+ // CHECK-C: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
+ // CHECK-CPP0X: private unnamed_addr constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
char b[10] = "\u1120\u0220\U00102030";
// CHECK-C: private unnamed_addr constant [12 x i8] c"A\00\00\00B\00\00\00\00\00\00\00", align 4