[PATCH] D54986: Make CodeGen choose when to emit vtables.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 29 10:59:08 PST 2018


rjmccall added inline comments.


================
Comment at: lib/AST/ASTContext.cpp:9801
+           RD->getTemplateSpecializationKind() ==
+               TSK_ExplicitInstantiationDefinition;
   else
----------------
Does it matter if it's not this particular declaration that's the explicit instantiation?


================
Comment at: lib/AST/RecordLayoutBuilder.cpp:3069
   const Decl *Result =
       Entry ? Entry.get(getExternalSource()) : computeKeyFunction(*this, RD);
 
----------------
Why not just change `computeKeyFunction` to decide that the class doesn't have a key function if it would be an inline definition?  We can do the same updating we do with the ARM rule except just bailing out instead of scanning for another candidate.


================
Comment at: lib/CodeGen/CGVTables.cpp:889
+  if (!llvm::GlobalValue::isDiscardableIfUnused(getVTableLinkage(theClass)))
+    getCXXABI().emitVTables(theClass);
 }
----------------
I feel like "don't emit the v-table for this" should be handled in the caller.


Repository:
  rC Clang

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

https://reviews.llvm.org/D54986





More information about the cfe-commits mailing list