[llvm-branch-commits] [cfe-branch] r324219 - Merging r324059:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Feb 5 01:59:14 PST 2018


Author: hans
Date: Mon Feb  5 01:59:14 2018
New Revision: 324219

URL: http://llvm.org/viewvc/llvm-project?rev=324219&view=rev
Log:
Merging r324059:
------------------------------------------------------------------------
r324059 | mstorsjo | 2018-02-02 07:22:35 +0100 (Fri, 02 Feb 2018) | 21 lines

[MinGW] Emit typeinfo locally for dllimported classes without key functions

This fixes building Qt as shared libraries with clang in MinGW
mode; previously subclasses of the QObjectData class (in other
DLLs than the base DLL) failed to find the typeinfo symbols
(that neither were emitted in the base DLL nor in the DLL
containing the subclass).

If the virtual destructor in the newly added testcase wouldn't
be pure (or if there'd be another non-pure virtual method),
it'd be a key function and things would work out even before this
change. Make sure to locally emit the typeinfo for these classes
as well.

This matches what GCC does in this specific testcase.

This fixes the root issue that spawned PR35146. (The difference
to GCC that is initially described in that bug still is present
though.)

Differential Revision: https://reviews.llvm.org/D42641
------------------------------------------------------------------------

Added:
    cfe/branches/release_60/test/CodeGenCXX/dllimport-missing-key.cpp
      - copied unchanged from r324059, cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp
Modified:
    cfe/branches/release_60/   (props changed)
    cfe/branches/release_60/lib/CodeGen/ItaniumCXXABI.cpp
    cfe/branches/release_60/test/CodeGenCXX/dllimport-rtti.cpp

Propchange: cfe/branches/release_60/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb  5 01:59:14 2018
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323935,324134
+/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323935,324059,324134
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_60/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/lib/CodeGen/ItaniumCXXABI.cpp?rev=324219&r1=324218&r2=324219&view=diff
==============================================================================
--- cfe/branches/release_60/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/branches/release_60/lib/CodeGen/ItaniumCXXABI.cpp Mon Feb  5 01:59:14 2018
@@ -2761,6 +2761,11 @@ static bool ShouldUseExternalRTTIDescrip
     // 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

Modified: cfe/branches/release_60/test/CodeGenCXX/dllimport-rtti.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/test/CodeGenCXX/dllimport-rtti.cpp?rev=324219&r1=324218&r2=324219&view=diff
==============================================================================
--- cfe/branches/release_60/test/CodeGenCXX/dllimport-rtti.cpp (original)
+++ cfe/branches/release_60/test/CodeGenCXX/dllimport-rtti.cpp Mon Feb  5 01:59:14 2018
@@ -12,7 +12,7 @@ struct __declspec(dllimport) S {
 // 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;




More information about the llvm-branch-commits mailing list