diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 3 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/visibility.cpp | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 614eaab3f37..429d2c8ccac 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -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); diff --git a/clang/test/CodeGenCXX/visibility.cpp b/clang/test/CodeGenCXX/visibility.cpp index 87add446ba7..c5c47abd2b9 100644 --- a/clang/test/CodeGenCXX/visibility.cpp +++ b/clang/test/CodeGenCXX/visibility.cpp @@ -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. +} |

