[PATCH] D11441: Generating available_externally vtables for classes without inline virtual functions

David Majnemer david.majnemer at gmail.com
Wed Jul 22 17:35:44 PDT 2015


majnemer added inline comments.

================
Comment at: lib/CodeGen/CGVTables.cpp:706
@@ +705,3 @@
+               "optimizations");
+        if (!def && CodeGenOpts.OptimizationLevel)
+          return llvm::GlobalVariable::AvailableExternallyLinkage;
----------------
I'd suggest using `OptimizationLevel > 0` instead.

================
Comment at: lib/CodeGen/CGVTables.cpp:829
@@ -821,1 +828,3 @@
                                                    const CXXRecordDecl *RD) {
+  if (CGM.getCXXABI().canEmitAvailableExternallyVTable(RD)) return true;
+
----------------
Please clang-format this.

================
Comment at: lib/CodeGen/ItaniumCXXABI.cpp:311-319
@@ +310,11 @@
+  bool hasAnyVirtualInlineFunction(const CXXRecordDecl *RD) const {
+    const auto &vtableLayout =
+        CGM.getItaniumVTableContext().getVTableLayout(RD);
+
+    for (const auto &vtableComponent : vtableLayout.vtable_components()) {
+      if (vtableComponent.getKind() !=
+          VTableComponent::Kind::CK_FunctionPointer)
+        continue;
+
+      const auto &method = vtableComponent.getFunctionDecl();
+      if (method->getMostRecentDecl()->isInlined()) return true;
----------------
Local variables should start with a capital letter.

================
Comment at: lib/CodeGen/ItaniumCXXABI.cpp:320
@@ +319,3 @@
+      const auto &method = vtableComponent.getFunctionDecl();
+      if (method->getMostRecentDecl()->isInlined()) return true;
+    }
----------------
Would we want to use `getCanonicalDecl` instead?


http://reviews.llvm.org/D11441







More information about the cfe-commits mailing list