Compute the visibility of static local variables consistently. Fixes PR16208.

llvm-svn: 184137
This commit is contained in:
Eli Friedman 2013-06-17 21:51:45 +00:00
parent 180795863d
commit 40a4becb11
2 changed files with 19 additions and 2 deletions

View File

@ -218,8 +218,7 @@ CodeGenFunction::CreateStaticVarDecl(const VarDecl &D,
llvm::GlobalVariable::NotThreadLocal,
AddrSpace);
GV->setAlignment(getContext().getDeclAlign(&D).getQuantity());
if (Linkage != llvm::GlobalValue::InternalLinkage)
GV->setVisibility(CurFn->getVisibility());
CGM.setGlobalVisibility(GV, &D);
if (D.getTLSKind())
CGM.setTLSMode(GV, D);

View File

@ -139,6 +139,10 @@ namespace test27 {
// CHECK: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr global i64
// CHECK-HIDDEN: @_ZZN6Test193fooIiEEvvE1a = linkonce_odr hidden global
// CHECK-HIDDEN: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr hidden global i64
// CHECK: @_ZZN6test681fC1EvE4test = linkonce_odr global
// CHECK: @_ZGVZN6test681fC1EvE4test = linkonce_odr global
// CHECK-HIDDEN: @_ZZN6test681fC1EvE4test = linkonce_odr hidden global
// CHECK-HIDDEN: @_ZGVZN6test681fC1EvE4test = linkonce_odr hidden global
// CHECK-HIDDEN: @_ZTVN6Test161AIcEE = external unnamed_addr constant
// CHECK-HIDDEN: @_ZTTN6Test161AIcEE = external unnamed_addr constant
// CHECK: @_ZTVN5Test63fooE = linkonce_odr hidden unnamed_addr constant
@ -1277,3 +1281,17 @@ namespace test67 {
// CHECK: define weak_odr void @_ZN6test673barINS_3fooEE3zedEv
// CHECK-HIDDEN: define weak_odr void @_ZN6test673barINS_3fooEE3zedEv
}
namespace test68 {
class A { public: ~A(); };
class f {
public:
f() {
static A test;
}
};
void g() {
f a;
}
// Check lines at top of file.
}