r184137 - Compute the visibility of static local variables consistently. Fixes PR16208.
Eli Friedman
eli.friedman at gmail.com
Mon Jun 17 14:51:45 PDT 2013
Author: efriedma
Date: Mon Jun 17 16:51:45 2013
New Revision: 184137
URL: http://llvm.org/viewvc/llvm-project?rev=184137&view=rev
Log:
Compute the visibility of static local variables consistently. Fixes PR16208.
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/test/CodeGenCXX/visibility.cpp
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=184137&r1=184136&r2=184137&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Jun 17 16:51:45 2013
@@ -218,8 +218,7 @@ CodeGenFunction::CreateStaticVarDecl(con
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);
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=184137&r1=184136&r2=184137&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Mon Jun 17 16:51:45 2013
@@ -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.
+}
More information about the cfe-commits
mailing list