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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to