When emitting RTTI for EH only, we would mark the locally defined (LinkOnceODR)
RTTI definition as dllimport, which is incorrect. Ensure that if we are
generating the type information for EH only, it is marked as LinkOnceODR and we
do not make it dllimport.
llvm-svn: 288721
if (DLLExport || (RD && RD->hasAttr<DLLExportAttr>())) {
TypeName->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
GV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
- } else if (RD && RD->hasAttr<DLLImportAttr>()) {
+ } else if (CGM.getLangOpts().RTTI && RD && RD->hasAttr<DLLImportAttr>()) {
TypeName->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
-// RUN: %clang_cc1 -triple i686-windows-itanium -fdeclspec -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i686-windows-itanium -fdeclspec -fcxx-exceptions -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i686-windows-itanium -fdeclspec -fcxx-exceptions -fno-rtti -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-EH-IMPORT
namespace __cxxabiv1 {
class __declspec(dllexport) __fundamental_type_info {
method();
}
+void f() {
+ throw base();
+}
+
// CHECK-DAG: @_ZTIi = dllexport constant
// CHECK-DAG: @_ZTSi = dllexport constant
// CHECK-DAG: @_ZTS4base = external dllimport constant
// CHECK-NOT: @_ZTV4base = external dllimport constant
+// CHECK-EH-IMPORT: @_ZTS4base = linkonce_odr constant
+// CHECK-EH-IMPORT: @_ZTI4base = linkonce_odr constant
+