[PATCH] D33437: Emit available_externally vtables opportunistically
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 26 07:52:41 PDT 2017
rjmccall added inline comments.
================
Comment at: include/clang/AST/VTableBuilder.h:160
+ "GlobalDecl can be created only from virtual function");
+ if (getKind() == CK_FunctionPointer)
+ return GlobalDecl(getFunctionDecl());
----------------
Please use an exhaustive switch. You can put llvm_unreachable in the other cases.
================
Comment at: lib/CodeGen/CGVTables.cpp:905
+ else
+ OpportunisticVTables.push_back(RD);
----------------
I would add a CGM.shouldOpportunisticallyEmitVTables() that can just check the optimization level, and then you can use that to avoid even collecting v-tables like this if you don't need to.
================
Comment at: lib/CodeGen/CodeGenModule.cpp:1377
+void CodeGenModule::EmitVTablesOpportunistically() {
+ // Only emit speculated vtables with optimizations.
----------------
It's worth adding a header comment to this explaining that it runs after EmitDeferred() and therefore is not allowed to create new references to things that need to be emitted lazily.
https://reviews.llvm.org/D33437
More information about the cfe-commits
mailing list