[PATCH] D55698: [MinGW] Produce a vtable and RTTI for dllexported classes without a key function

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 14 12:06:30 PST 2018


rnk added inline comments.


================
Comment at: lib/Sema/SemaDeclCXX.cpp:5754-5756
+  if (ClassExported &&
+      Context.getTargetInfo().getTriple().isWindowsGNUEnvironment())
+    MarkVTableUsed(Class->getLocation(), Class, true);
----------------
This may be too early, you can get into situations like this if you start emitting the vtable (which will emit inline methods) before we get to the end of the outermost class. See this bug for example:
https://bugs.llvm.org/show_bug.cgi?id=40006

Maybe if you have a dllexported nested class with a virtual method that references the constructor of the outer class which has a late-parsed member initializer... you can get things to go wrong as in the bug above.

I think the fix will be to touch the vtable when we process delayed dllexported classes from the list just above this line.


================
Comment at: test/CodeGenCXX/dllexport-missing-key.cpp:20
+
+// GNU-DAG: @_ZTV24QAbstractLayoutStyleInfo = weak_odr dso_local dllexport
+// GNU-DAG: @_ZTS24QAbstractLayoutStyleInfo = linkonce_odr
----------------
OK, good, I was going to ask if it became weak_odr, but looks like it all works.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55698/new/

https://reviews.llvm.org/D55698





More information about the cfe-commits mailing list