Skip to content

Commit

Permalink
[MinGW] Always emit local typeinfo
Browse files Browse the repository at this point in the history
This makes sure that code built with headers for a statically linked
libc++ also works when linking to the DLL version, when the DLL
hasn't been built with --export-all-symbols.

This matches what GCC for MinGW does for this test case.

Differential Revision: https://reviews.llvm.org/D61177

llvm-svn: 359345
  • Loading branch information
mstorsjo committed Apr 26, 2019
1 parent 3820506 commit 228ccd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/ItaniumCXXABI.cpp
Expand Up @@ -2959,7 +2959,7 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM,
bool IsDLLImport = RD->hasAttr<DLLImportAttr>();

// Don't import the RTTI but emit it locally.
if (CGM.getTriple().isWindowsGNUEnvironment() && IsDLLImport)
if (CGM.getTriple().isWindowsGNUEnvironment())
return false;

if (CGM.getVTables().isVTableExternal(RD))
Expand Down
10 changes: 6 additions & 4 deletions clang/test/CodeGenCXX/vtable-key-function-ios.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck -check-prefixes=CHECK,CHECK-UNIX %s
// RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck -check-prefix=CHECK-LATE %s

// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | FileCheck -check-prefixes=CHECK,CHECK-MINGW %s
// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | FileCheck -check-prefix=CHECK-LATE %s

// The 'a' variants ask for the vtable first.
Expand Down Expand Up @@ -29,7 +29,8 @@ struct Test0a {
// V-table should be defined externally.
Test0a::Test0a() { use(typeid(Test0a)); }
// CHECK: @_ZTV6Test0a = external {{(dso_local )?}}unnamed_addr constant
// CHECK: @_ZTI6Test0a = external {{(dso_local )?}}constant
// CHECK-UNIX: @_ZTI6Test0a = external {{(dso_local )?}}constant
// CHECK-MINGW: @_ZTI6Test0a = linkonce_odr {{(dso_local )?}}constant

// This is not a key function.
void Test0a::foo() {}
Expand All @@ -48,7 +49,8 @@ void Test0b::foo() {}
// V-table should be defined externally.
Test0b::Test0b() { use(typeid(Test0b)); }
// CHECK: @_ZTV6Test0b = external {{(dso_local )?}}unnamed_addr constant
// CHECK: @_ZTI6Test0b = external {{(dso_local )?}}constant
// CHECK-UNIX: @_ZTI6Test0b = external {{(dso_local )?}}constant
// CHECK-MINGW: @_ZTI6Test0b = linkonce_odr {{(dso_local )?}}constant

/*** Test1a ******************************************************************/

Expand Down

0 comments on commit 228ccd6

Please sign in to comment.