[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 12:00:46 PDT 2024


================
@@ -6853,6 +6853,13 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
         if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never)
           DI->completeUnusedClass(*CRD);
     }
+    // If we're emitting a dynamic class from the importable module we're
+    // emitting, we always need to emit the virtual table according to the ABI
+    // requirement.
+    if (CRD->getDefinition() && CRD->isDynamicClass() &&
+        CRD->isInCurrentModuleUnit())
+      EmitVTable(CRD);
----------------
efriedma-quic wrote:

Is this really necessary?  The existing logic in SemaDeclCXX.cpp should call EmitVTable() when the vtable is considered used.

https://github.com/llvm/llvm-project/pull/75912


More information about the cfe-commits mailing list