From: Douglas Gregor Date: Mon, 14 Jun 2010 23:41:45 +0000 (+0000) Subject: Make sure to set the visible on a vtable; VTTs and typeinfo already X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c66bcfd32b941d8008284ecae9d16d7d47c96b0b;p=clang Make sure to set the visible on a vtable; VTTs and typeinfo already handle visibility properly. Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105977 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 9d8ab5adb0..6abac2609f 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -2926,6 +2926,9 @@ CodeGenVTables::EmitVTableDefinition(llvm::GlobalVariable *VTable, // Set the correct linkage. VTable->setLinkage(Linkage); + + // Set the right visibility. + CGM.setGlobalVisibility(VTable, RD); } llvm::GlobalVariable * diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index 5edd27b8b2..ee3c1795fb 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -5,7 +5,7 @@ #define DEFAULT __attribute__((visibility("default"))) // CHECK: @_ZN5Test425VariableInHiddenNamespaceE = hidden global i32 10 - +// CHECK: @_ZTVN5Test63fooE = weak_odr hidden constant namespace Test1 { // CHECK: define hidden void @_ZN5Test11fEv void HIDDEN f() { } @@ -64,3 +64,21 @@ namespace Test5 { void g() { } } } + +// +namespace Test6 { + struct HIDDEN foo { + foo() { } + void bonk(); + virtual void bar() = 0; + + virtual void zonk() {} + }; + + struct barc : public foo { + barc(); + virtual void bar(); + }; + + barc::barc() {} +}