Handle static data members.
http://reviews.llvm.org/D3515
Files:
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/const-init-cxx11.cpp
test/CodeGenCXX/const-init-cxx1y.cpp
test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp
test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
test/CodeGenCXX/cxx11-thread-local.cpp
test/CodeGenCXX/temporaries.cpp
Index: lib/CodeGen/CGDecl.cpp
===================================================================
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -126,17 +126,11 @@
void CodeGenFunction::EmitVarDecl(const VarDecl &D) {
if (D.isStaticLocal()) {
llvm::GlobalValue::LinkageTypes Linkage =
- llvm::GlobalValue::InternalLinkage;
+ CGM.GetLLVMLinkageVarDefinition(&D, /*isConstant=*/false);
- // If the variable is externally visible, it must have weak linkage so it
- // can be uniqued.
- if (D.isExternallyVisible()) {
- Linkage = llvm::GlobalValue::LinkOnceODRLinkage;
-
- // FIXME: We need to force the emission/use of a guard variable for
- // some variables even if we can constant-evaluate them because
- // we can't guarantee every translation unit will constant-evaluate them.
- }
+ // FIXME: We need to force the emission/use of a guard variable for
+ // some variables even if we can constant-evaluate them because
+ // we can't guarantee every translation unit will constant-evaluate them.
return EmitStaticVarDecl(D, Linkage);
}
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -2001,9 +2001,17 @@
// If required by the ABI, give definitions of static data members with inline
// initializers linkonce_odr linkage.
return llvm::GlobalVariable::LinkOnceODRLinkage;
- // C++ doesn't have tentative definitions and thus cannot have common linkage.
- else if (!getLangOpts().CPlusPlus &&
- !isVarDeclStrongDefinition(D, CodeGenOpts.NoCommon))
+ else if (D->isStaticLocal()) {
+ // If the variable is externally visible, it must have weak linkage so it
+ // can be uniqued.
+ if (D->isExternallyVisible())
+ return llvm::GlobalValue::LinkOnceODRLinkage;
+ else
+ return llvm::GlobalValue::InternalLinkage;
+ } else if (!getLangOpts().CPlusPlus &&
+ !isVarDeclStrongDefinition(D, CodeGenOpts.NoCommon))
+ // C++ doesn't have tentative definitions and thus cannot have common
+ // linkage.
return llvm::GlobalVariable::CommonLinkage;
return llvm::GlobalVariable::ExternalLinkage;
@@ -2860,10 +2868,14 @@
}
// Create a global variable for this lifetime-extended temporary.
- llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(getModule(), Type, Constant,
- llvm::GlobalValue::PrivateLinkage,
- InitialValue, Name.c_str());
+ llvm::GlobalValue::LinkageTypes Linkage =
+ GetLLVMLinkageVarDefinition(VD, Constant);
+ unsigned AddrSpace = GetGlobalVarAddressSpace(
+ VD, getContext().getTargetAddressSpace(MaterializedType));
+ llvm::GlobalVariable *GV = new llvm::GlobalVariable(
+ getModule(), Type, Constant, Linkage, InitialValue, Name.c_str(),
+ /*InsertBefore=*/nullptr, llvm::GlobalVariable::NotThreadLocal,
+ AddrSpace);
GV->setAlignment(
getContext().getTypeAlignInChars(MaterializedType).getQuantity());
if (VD->getTLSKind())
Index: test/CodeGenCXX/const-init-cxx11.cpp
===================================================================
--- test/CodeGenCXX/const-init-cxx11.cpp
+++ test/CodeGenCXX/const-init-cxx11.cpp
@@ -226,43 +226,43 @@
};
// This creates a non-const temporary and binds a reference to it.
- // CHECK: @[[TEMP:.*]] = private global {{.*}} { i32 5 }, align 4
+ // CHECK: @[[TEMP:.*]] = global {{.*}} { i32 5 }, align 4
// CHECK: @_ZN16LiteralReference3litE = constant {{.*}} @[[TEMP]], align 8
const Lit &lit = Lit();
// This creates a const temporary as part of the reference initialization.
- // CHECK: @[[TEMP:.*]] = private constant {{.*}} { i32 5 }, align 4
+ // CHECK: @[[TEMP:.*]] = constant {{.*}} { i32 5 }, align 4
// CHECK: @_ZN16LiteralReference4lit2E = constant {{.*}} @[[TEMP]], align 8
const Lit &lit2 = {};
struct A { int &&r1; const int &&r2; };
struct B { A &&a1; const A &&a2; };
B b = { { 0, 1 }, { 2, 3 } };
- // CHECK: @[[TEMP0:.*]] = private global i32 0, align 4
- // CHECK: @[[TEMP1:.*]] = private constant i32 1, align 4
- // CHECK: @[[TEMPA1:.*]] = private global {{.*}} { i32* @[[TEMP0]], i32* @[[TEMP1]] }, align 8
- // CHECK: @[[TEMP2:.*]] = private global i32 2, align 4
- // CHECK: @[[TEMP3:.*]] = private constant i32 3, align 4
- // CHECK: @[[TEMPA2:.*]] = private constant {{.*}} { i32* @[[TEMP2]], i32* @[[TEMP3]] }, align 8
+ // CHECK: @[[TEMP0:.*]] = global i32 0, align 4
+ // CHECK: @[[TEMP1:.*]] = constant i32 1, align 4
+ // CHECK: @[[TEMPA1:.*]] = global {{.*}} { i32* @[[TEMP0]], i32* @[[TEMP1]] }, align 8
+ // CHECK: @[[TEMP2:.*]] = global i32 2, align 4
+ // CHECK: @[[TEMP3:.*]] = constant i32 3, align 4
+ // CHECK: @[[TEMPA2:.*]] = constant {{.*}} { i32* @[[TEMP2]], i32* @[[TEMP3]] }, align 8
// CHECK: @_ZN16LiteralReference1bE = global {{.*}} { {{.*}}* @[[TEMPA1]], {{.*}}* @[[TEMPA2]] }, align 8
struct Subobj {
int a, b, c;
};
- // CHECK: @[[TEMP:.*]] = private global {{.*}} { i32 1, i32 2, i32 3 }, align 4
+ // CHECK: @[[TEMP:.*]] = global {{.*}} { i32 1, i32 2, i32 3 }, align 4
// CHECK: @_ZN16LiteralReference2soE = constant {{.*}} (i8* getelementptr {{.*}} @[[TEMP]]{{.*}}, i64 4)
constexpr int &&so = Subobj{ 1, 2, 3 }.b;
struct Dummy { int padding; };
struct Derived : Dummy, Subobj {
constexpr Derived() : Dummy{200}, Subobj{4, 5, 6} {}
};
using ConstDerived = const Derived;
- // CHECK: @[[TEMPCOMMA:.*]] = private constant {{.*}} { i32 200, i32 4, i32 5, i32 6 }
+ // CHECK: @[[TEMPCOMMA:.*]] = constant {{.*}} { i32 200, i32 4, i32 5, i32 6 }
// CHECK: @_ZN16LiteralReference5commaE = constant {{.*}} getelementptr {{.*}} @[[TEMPCOMMA]]{{.*}}, i64 8)
constexpr const int &comma = (1, (2, ConstDerived{}).b);
- // CHECK: @[[TEMPDERIVED:.*]] = private global {{.*}} { i32 200, i32 4, i32 5, i32 6 }
+ // CHECK: @[[TEMPDERIVED:.*]] = global {{.*}} { i32 200, i32 4, i32 5, i32 6 }
// CHECK: @_ZN16LiteralReference4baseE = constant {{.*}} getelementptr {{.*}} @[[TEMPDERIVED]]{{.*}}, i64 4)
constexpr Subobj &&base = Derived{};
@@ -371,18 +371,18 @@
namespace ArrayTemporary {
struct A { const int (&x)[3]; };
struct B { const A (&x)[2]; };
- // CHECK: @[[A1:_ZGRN14ArrayTemporary1bE.*]] = private constant [3 x i32] [i32 1, i32 2, i32 3]
- // CHECK: @[[A2:_ZGRN14ArrayTemporary1bE.*]] = private constant [3 x i32] [i32 4, i32 5, i32 6]
- // CHECK: @[[ARR:_ZGRN14ArrayTemporary1bE.*]] = private constant [2 x {{.*}}] [{{.*}} { [3 x i32]* @[[A1]] }, {{.*}} { [3 x i32]* @[[A2]] }]
- // CHECK: @[[B:_ZGRN14ArrayTemporary1bE.*]] = private global {{.*}} { [2 x {{.*}}]* @[[ARR]] }
+ // CHECK: @[[A1:_ZGRN14ArrayTemporary1bE.*]] = constant [3 x i32] [i32 1, i32 2, i32 3]
+ // CHECK: @[[A2:_ZGRN14ArrayTemporary1bE.*]] = constant [3 x i32] [i32 4, i32 5, i32 6]
+ // CHECK: @[[ARR:_ZGRN14ArrayTemporary1bE.*]] = constant [2 x {{.*}}] [{{.*}} { [3 x i32]* @[[A1]] }, {{.*}} { [3 x i32]* @[[A2]] }]
+ // CHECK: @[[B:_ZGRN14ArrayTemporary1bE.*]] = global {{.*}} { [2 x {{.*}}]* @[[ARR]] }
// CHECK: @_ZN14ArrayTemporary1bE = constant {{.*}}* @[[B]]
B &&b = { { { { 1, 2, 3 } }, { { 4, 5, 6 } } } };
}
namespace UnemittedTemporaryDecl {
constexpr int &&ref = 0;
extern constexpr int &ref2 = ref;
- // CHECK: @_ZGRN22UnemittedTemporaryDecl3refE = private global i32 0
+ // CHECK: @_ZGRN22UnemittedTemporaryDecl3refE = global i32 0
// FIXME: This declaration should not be emitted -- it isn't odr-used.
// CHECK: @_ZN22UnemittedTemporaryDecl3refE
@@ -393,6 +393,9 @@
// CHECK: @_ZZN12LocalVarInit3aggEvE1a = internal constant {{.*}} i32 101
// CHECK: @_ZZN12LocalVarInit4ctorEvE1a = internal constant {{.*}} i32 102
// CHECK: @_ZZN12LocalVarInit8mutable_EvE1a = private unnamed_addr constant {{.*}} i32 103
+// CHECK: @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE = weak_odr constant i32 5
+// CHECK: @_ZN33ClassTemplateWithStaticDataMember3useE = constant i32* @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE
+// CHECK: @_ZGRZN20InlineStaticConstRef3funEvE1i = linkonce_odr constant i32 10
// Constant initialization tests go before this point,
// dynamic initialization tests go after.
@@ -552,3 +555,22 @@
// CHECK: call {{.*}} @_ZN4Null4nullEv(
int S::*q = null();
}
+
+namespace InlineStaticConstRef {
+ inline const int &fun() {
+ static const int &i = 10;
+ return i;
+ // CHECK: ret i32* @_ZGRZN20InlineStaticConstRef3funEvE1i
+ }
+ const int &use = fun();
+}
+
+namespace ClassTemplateWithStaticDataMember {
+ template <typename T>
+ struct S {
+ static const int &a;
+ };
+ template <typename T>
+ const int &S<T>::a = 5;
+ const int &use = S<void>::a;
+}
Index: test/CodeGenCXX/const-init-cxx1y.cpp
===================================================================
--- test/CodeGenCXX/const-init-cxx1y.cpp
+++ test/CodeGenCXX/const-init-cxx1y.cpp
@@ -23,21 +23,29 @@
struct A { int &&temporary; int x; };
constexpr int f(int &r) { r *= 9; return r - 12; }
A a = { 6, f(a.temporary) };
- // CHECK: @_ZGRN21ModifyStaticTemporary1aE = private global i32 54
+ // CHECK: @_ZGRN21ModifyStaticTemporary1aE = global i32 54
// CHECK: @_ZN21ModifyStaticTemporary1aE = global {{.*}} i32* @_ZGRN21ModifyStaticTemporary1aE, i32 42
A b = { 7, ++b.temporary };
- // CHECK: @_ZGRN21ModifyStaticTemporary1bE = private global i32 8
+ // CHECK: @_ZGRN21ModifyStaticTemporary1bE = global i32 8
// CHECK: @_ZN21ModifyStaticTemporary1bE = global {{.*}} i32* @_ZGRN21ModifyStaticTemporary1bE, i32 8
// Can't emit all of 'c' as a constant here, so emit the initial value of
// 'c.temporary', not the value as modified by the partial evaluation within
// the initialization of 'c.x'.
A c = { 10, (++c.temporary, b.x) };
- // CHECK: @_ZGRN21ModifyStaticTemporary1cE = private global i32 10
+ // CHECK: @_ZGRN21ModifyStaticTemporary1cE = global i32 10
// CHECK: @_ZN21ModifyStaticTemporary1cE = global {{.*}} zeroinitializer
}
+// CHECK: @_ZGRN28VariableTemplateWithConstRef1iIvEE = weak_odr constant i32 5, align 4
+// CHECK: @_ZN28VariableTemplateWithConstRef3useE = constant i32* @_ZGRN28VariableTemplateWithConstRef1iIvEE
+namespace VariableTemplateWithConstRef {
+ template <typename T>
+ const int &i = 5;
+ const int &use = i<void>;
+}
+
// CHECK: __cxa_atexit({{.*}} @_ZN1BD1Ev {{.*}} @b
// CHECK: define
Index: test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp
===================================================================
--- test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp
+++ test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-pr12086.cpp
@@ -55,21 +55,21 @@
{1, a}, {3, b}, {5, c}
};
-// CHECK-STATIC-BL: @_ZGR6nested = private constant [2 x i32] [i32 1, i32 2], align 4
-// CHECK-STATIC-BL: @_ZGR6nested1 = private constant [2 x i32] [i32 3, i32 4], align 4
-// CHECK-STATIC-BL: @_ZGR6nested2 = private constant [2 x i32] [i32 5, i32 6], align 4
-// CHECK-STATIC-BL: @_ZGR6nested3 = private constant [3 x {{.*}}] [
+// CHECK-STATIC-BL: @_ZGR6nested = constant [2 x i32] [i32 1, i32 2], align 4
+// CHECK-STATIC-BL: @_ZGR6nested1 = constant [2 x i32] [i32 3, i32 4], align 4
+// CHECK-STATIC-BL: @_ZGR6nested2 = constant [2 x i32] [i32 5, i32 6], align 4
+// CHECK-STATIC-BL: @_ZGR6nested3 = constant [3 x {{.*}}] [
// CHECK-STATIC-BL: {{.*}} { i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested, i32 0, i32 0), i64 2 },
// CHECK-STATIC-BL: {{.*}} { i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i32 0, i32 0), i64 2 },
// CHECK-STATIC-BL: {{.*}} { i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested2, i32 0, i32 0), i64 2 }
// CHECK-STATIC-BL: ], align 8
// CHECK-STATIC-BL: @nested = global {{.*}} { {{.*}} getelementptr inbounds ([3 x {{.*}}]* @_ZGR6nested3, i32 0, i32 0), i64 3 }, align 8
// CHECK-DYNAMIC-BL: @nested = global
-// CHECK-DYNAMIC-BL: @_ZGR6nested = private global [3 x
-// CHECK-DYNAMIC-BL: @_ZGR6nested1 = private global [2 x i32] zeroinitializer
-// CHECK-DYNAMIC-BL: @_ZGR6nested2 = private global [2 x i32] zeroinitializer
-// CHECK-DYNAMIC-BL: @_ZGR6nested3 = private global [2 x i32] zeroinitializer
+// CHECK-DYNAMIC-BL: @_ZGR6nested = global [3 x
+// CHECK-DYNAMIC-BL: @_ZGR6nested1 = global [2 x i32] zeroinitializer
+// CHECK-DYNAMIC-BL: @_ZGR6nested2 = global [2 x i32] zeroinitializer
+// CHECK-DYNAMIC-BL: @_ZGR6nested3 = global [2 x i32] zeroinitializer
// CHECK-DYNAMIC-BL: store i32 1, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0)
// CHECK-DYNAMIC-BL: store i32 {{.*}}, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 1)
// CHECK-DYNAMIC-BL: store i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0),
@@ -89,10 +89,10 @@
// CHECK-DYNAMIC-BL: {{.*}}** getelementptr inbounds ({{.*}}* @nested, i32 0, i32 0), align 8
// CHECK-DYNAMIC-BL: store i64 3, i64* getelementptr inbounds ({{.*}}* @nested, i32 0, i32 1), align 8
-// CHECK-STATIC-BE: @_ZGR6nested = private constant [2 x i32] [i32 1, i32 2], align 4
-// CHECK-STATIC-BE: @_ZGR6nested1 = private constant [2 x i32] [i32 3, i32 4], align 4
-// CHECK-STATIC-BE: @_ZGR6nested2 = private constant [2 x i32] [i32 5, i32 6], align 4
-// CHECK-STATIC-BE: @_ZGR6nested3 = private constant [3 x {{.*}}] [
+// CHECK-STATIC-BE: @_ZGR6nested = constant [2 x i32] [i32 1, i32 2], align 4
+// CHECK-STATIC-BE: @_ZGR6nested1 = constant [2 x i32] [i32 3, i32 4], align 4
+// CHECK-STATIC-BE: @_ZGR6nested2 = constant [2 x i32] [i32 5, i32 6], align 4
+// CHECK-STATIC-BE: @_ZGR6nested3 = constant [3 x {{.*}}] [
// CHECK-STATIC-BE: {{.*}} { i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested, i32 0, i32 0),
// CHECK-STATIC-BE: i32* bitcast (i8* getelementptr (i8* bitcast ([2 x i32]* @_ZGR6nested to i8*), i64 8) to i32*) }
// CHECK-STATIC-BE: {{.*}} { i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i32 0, i32 0),
@@ -104,10 +104,10 @@
// CHECK-STATIC-BE: {{.*}} bitcast ({{.*}}* getelementptr (i8* bitcast ([3 x {{.*}}]* @_ZGR6nested3 to i8*), i64 48) to {{.*}}*) }
// CHECK-DYNAMIC-BE: @nested = global
-// CHECK-DYNAMIC-BE: @_ZGR6nested = private global [3 x
-// CHECK-DYNAMIC-BE: @_ZGR6nested1 = private global [2 x i32] zeroinitializer
-// CHECK-DYNAMIC-BE: @_ZGR6nested2 = private global [2 x i32] zeroinitializer
-// CHECK-DYNAMIC-BE: @_ZGR6nested3 = private global [2 x i32] zeroinitializer
+// CHECK-DYNAMIC-BE: @_ZGR6nested = global [3 x
+// CHECK-DYNAMIC-BE: @_ZGR6nested1 = global [2 x i32] zeroinitializer
+// CHECK-DYNAMIC-BE: @_ZGR6nested2 = global [2 x i32] zeroinitializer
+// CHECK-DYNAMIC-BE: @_ZGR6nested3 = global [2 x i32] zeroinitializer
// CHECK-DYNAMIC-BE: store i32 1, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0)
// CHECK-DYNAMIC-BE: store i32 {{.*}}, i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 1)
// CHECK-DYNAMIC-BE: store i32* getelementptr inbounds ([2 x i32]* @_ZGR6nested1, i64 0, i64 0),
Index: test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
===================================================================
--- test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
+++ test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
@@ -32,7 +32,7 @@
};
}
-// CHECK: @_ZGR15globalInitList1 = private constant [3 x i32] [i32 1, i32 2, i32 3]
+// CHECK: @_ZGR15globalInitList1 = constant [3 x i32] [i32 1, i32 2, i32 3]
// CHECK: @globalInitList1 = global {{[^ ]+}} { i32* getelementptr inbounds ([3 x i32]* @_ZGR15globalInitList1, {{[^)]*}}), i32*
std::initializer_list<int> globalInitList1 = {1, 2, 3};
Index: test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
===================================================================
--- test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -47,7 +47,7 @@
~wantslist1();
};
-// CHECK: @_ZGR15globalInitList1 = private constant [3 x i32] [i32 1, i32 2, i32 3]
+// CHECK: @_ZGR15globalInitList1 = constant [3 x i32] [i32 1, i32 2, i32 3]
// CHECK: @globalInitList1 = global %{{[^ ]+}} { i32* getelementptr inbounds ([3 x i32]* @_ZGR15globalInitList1, i32 0, i32 0), i{{32|64}} 3 }
std::initializer_list<int> globalInitList1 = {1, 2, 3};
@@ -57,20 +57,20 @@
// objects aren't really a problem).
//
// CHECK: @_ZN25thread_local_global_array1xE = thread_local global
- // CHECK: @_ZGRN25thread_local_global_array1xE = private thread_local constant [4 x i32] [i32 1, i32 2, i32 3, i32 4]
+ // CHECK: @_ZGRN25thread_local_global_array1xE = thread_local constant [4 x i32] [i32 1, i32 2, i32 3, i32 4]
std::initializer_list<int> thread_local x = { 1, 2, 3, 4 };
}
// CHECK: @globalInitList2 = global %{{[^ ]+}} zeroinitializer
-// CHECK: @_ZGR15globalInitList2 = private global [2 x %[[WITHARG:[^ ]*]]] zeroinitializer
+// CHECK: @_ZGR15globalInitList2 = global [2 x %[[WITHARG:[^ ]*]]] zeroinitializer
// CHECK: @_ZN15partly_constant1kE = global i32 0, align 4
// CHECK: @_ZN15partly_constant2ilE = global {{.*}} null, align 8
-// CHECK: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE.*]] = private global {{.*}} zeroinitializer, align 8
-// CHECK: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE.*]] = private global [3 x {{.*}}] zeroinitializer, align 8
-// CHECK: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE.*]] = private constant [3 x i32] [i32 1, i32 2, i32 3], align 4
-// CHECK: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE.*]] = private global [2 x i32] zeroinitializer, align 4
-// CHECK: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE.*]] = private constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
+// CHECK: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE.*]] = global {{.*}} zeroinitializer, align 8
+// CHECK: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE.*]] = global [3 x {{.*}}] zeroinitializer, align 8
+// CHECK: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE.*]] = constant [3 x i32] [i32 1, i32 2, i32 3], align 4
+// CHECK: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE.*]] = global [2 x i32] zeroinitializer, align 4
+// CHECK: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE.*]] = constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
// CHECK: appending global
Index: test/CodeGenCXX/cxx11-thread-local.cpp
===================================================================
--- test/CodeGenCXX/cxx11-thread-local.cpp
+++ test/CodeGenCXX/cxx11-thread-local.cpp
@@ -35,7 +35,7 @@
// CHECK: @_ZZ8tls_dtorvE1u = internal thread_local global
// CHECK: @_ZGVZ8tls_dtorvE1u = internal thread_local global i8 0
-// CHECK: @_ZGRZ8tls_dtorvE1u = private thread_local global
+// CHECK: @_ZGRZ8tls_dtorvE1u = internal thread_local global
// CHECK: @_ZGVN1VIiE1mE = weak_odr thread_local global i64 0
Index: test/CodeGenCXX/temporaries.cpp
===================================================================
--- test/CodeGenCXX/temporaries.cpp
+++ test/CodeGenCXX/temporaries.cpp
@@ -3,7 +3,7 @@
namespace PR16263 {
const unsigned int n = 1234;
extern const int &r = (const int&)n;
- // CHECK: @_ZGRN7PR162631rE = private constant i32 1234,
+ // CHECK: @_ZGRN7PR162631rE = constant i32 1234,
// CHECK: @_ZN7PR162631rE = constant i32* @_ZGRN7PR162631rE,
extern const int &s = reinterpret_cast<const int&>(n);
@@ -14,16 +14,16 @@
struct B { int n; };
struct C : A, B {};
extern const A &&a = (A&&)(A&&)(C&&)(C{});
- // CHECK: @_ZGRN7PR162631aE = private global {{.*}} zeroinitializer,
+ // CHECK: @_ZGRN7PR162631aE = global {{.*}} zeroinitializer,
// CHECK: @_ZN7PR162631aE = constant {{.*}} bitcast ({{.*}}* @_ZGRN7PR162631aE to
extern const int &&t = ((B&&)C{}).n;
- // CHECK: @_ZGRN7PR162631tE = private global {{.*}} zeroinitializer,
+ // CHECK: @_ZGRN7PR162631tE = global {{.*}} zeroinitializer,
// CHECK: @_ZN7PR162631tE = constant i32* {{.*}}* @_ZGRN7PR162631tE {{.*}} 4
struct D { double d; C c; };
extern const int &&u = (123, static_cast<B&&>(0, ((D&&)D{}).*&D::c).n);
- // CHECK: @_ZGRN7PR162631uE = private global {{.*}} zeroinitializer
+ // CHECK: @_ZGRN7PR162631uE = global {{.*}} zeroinitializer
// CHECK: @_ZN7PR162631uE = constant i32* {{.*}} @_ZGRN7PR162631uE {{.*}} 12
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits