[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 09:53:01 PDT 2024
================
@@ -1802,6 +1802,12 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT,
if (VTable->hasInitializer())
return;
+ // If the class is attached to a C++ named module other than the one
+ // we're currently compiling, the vtable should be defined there.
+ if (Module *M = RD->getOwningModule();
+ M && M->isNamedModule() && M != CGM.getContext().getCurrentNamedModule())
----------------
dwblaikie wrote:
Generally we do such cleanup before if there's already at least one use of the idiom that could be refactored without the patch applied, or in the patch - rather than after. (sometimes there's a need to do these things after, but this seems like a fine thing to include in this patch, or
https://github.com/llvm/llvm-project/pull/75912
More information about the cfe-commits
mailing list