[PATCH] D42641: [MinGW] Emit typeinfo locally for dllimported classes without key functions
Martin Storsjö via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 1 22:24:27 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324059: [MinGW] Emit typeinfo locally for dllimported classes without key functions (authored by mstorsjo, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D42641?vs=132045&id=132534#toc
Repository:
rL LLVM
https://reviews.llvm.org/D42641
Files:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp
cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp
Index: cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp
+++ cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp
@@ -12,7 +12,7 @@
// MSVC-DAG: @"\01??_R3S@@8" = linkonce_odr
// GNU-DAG: @_ZTV1S = available_externally dllimport
-// GNU-DAG: @_ZTI1S = external dllimport
+// GNU-DAG: @_ZTI1S = linkonce_odr
struct U : S {
} u;
Index: cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp
+++ cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -std=c++1y -O0 -o - %s -w | FileCheck --check-prefix=GNU %s
+
+class __declspec(dllimport) QObjectData {
+public:
+ virtual ~QObjectData() = 0;
+ void *ptr;
+
+ int method() const;
+};
+
+class LocalClass : public QObjectData {
+};
+
+void call() {
+ (new LocalClass())->method();
+}
+
+// GNU-DAG: @_ZTV11QObjectData = available_externally dllimport
+// GNU-DAG: @_ZTS11QObjectData = linkonce_odr
+// GNU-DAG: @_ZTI11QObjectData = linkonce_odr
Index: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
@@ -2761,6 +2761,11 @@
// N.B. We must always emit the RTTI data ourselves if there exists a key
// function.
bool IsDLLImport = RD->hasAttr<DLLImportAttr>();
+
+ // Don't import the RTTI but emit it locally.
+ if (CGM.getTriple().isWindowsGNUEnvironment() && IsDLLImport)
+ return false;
+
if (CGM.getVTables().isVTableExternal(RD))
return IsDLLImport && !CGM.getTriple().isWindowsItaniumEnvironment()
? false
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42641.132534.patch
Type: text/x-patch
Size: 1878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180202/23b835bb/attachment.bin>
More information about the cfe-commits
mailing list