diff options
-rw-r--r-- | lib/CodeGen/CGVTT.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/anonymous-namespaces.cpp | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/CGVTT.cpp b/lib/CodeGen/CGVTT.cpp index 15e564810f..61c74230e1 100644 --- a/lib/CodeGen/CGVTT.cpp +++ b/lib/CodeGen/CGVTT.cpp @@ -378,7 +378,7 @@ CodeGenVTables::GenerateVTT(llvm::GlobalVariable::LinkageTypes Linkage, D1(printf("vtt %s\n", RD->getNameAsCString())); - llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name); + llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true); if (GV == 0 || GV->isDeclaration()) { const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext()); diff --git a/test/CodeGenCXX/anonymous-namespaces.cpp b/test/CodeGenCXX/anonymous-namespaces.cpp index 695f8f59de..fb3470ca9b 100644 --- a/test/CodeGenCXX/anonymous-namespaces.cpp +++ b/test/CodeGenCXX/anonymous-namespaces.cpp @@ -1,6 +1,5 @@ // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s - int f(); namespace { @@ -20,6 +19,13 @@ namespace { int D::d = f(); + // Check for generation of a VTT with internal linkage + // CHECK: @_ZTSN12_GLOBAL__N_11X1EE = internal constant + struct X { + struct EBase { }; + struct E : public virtual EBase { virtual ~E() {} }; + }; + // CHECK: define internal i32 @_ZN12_GLOBAL__N_13fooEv() int foo() { return 32; @@ -36,3 +42,5 @@ namespace { int concrete() { return a + foo() + A::foo(); } + +void test_XE() { throw X::E(); } |