[PATCH] [ms-cxxabi] Emit linkonce complete dtors in TUs that need them

Timur Iskhodzhanov timurrrr at google.com
Fri Jul 12 06:11:17 PDT 2013



================
Comment at: lib/AST/MicrosoftMangle.cpp:588
@@ +587,3 @@
+  case Dtor_Complete: Out << "?_D"; return;
+  // <operator-name> ::= ?_G # scalar deleting destructor
+  case Dtor_Deleting: Out << "?_G"; return;
----------------
Can we have aliasing Dtor types or at least a comment about this in include/clang/Basic/ABI.h ?

The current mapping is very confusing.

================
Comment at: lib/CodeGen/CGCXX.cpp:285
@@ +284,3 @@
+  // size by calling the base dtor directly.
+  // XXX: We could do this for Itanium, but we should consult with John first.
+  if (getTarget().getCXXABI().isMicrosoft() && dtorType == Dtor_Complete &&
----------------
+1 for doing it in all ABIs.

================
Comment at: lib/CodeGen/CodeGenModule.cpp:522
@@ +521,3 @@
+  // to each other, bottoming out with the base dtor, which might be external.
+  if (getTarget().getCXXABI().isMicrosoft() && isa<CXXDestructorDecl>(D) &&
+      GD.getDtorType() != Dtor_Base)
----------------
how about getDestructorLinkage added to GCXXABI ?

================
Comment at: lib/CodeGen/CodeGenModule.cpp:1043
@@ +1042,3 @@
+  // as-needed basis.
+  if (getTarget().getCXXABI().isMicrosoft() && isa<CXXDestructorDecl>(D) &&
+      GD.getDtorType() != Dtor_Base)
----------------
ditto?

================
Comment at: test/CodeGenCXX/microsoft-abi-structors.cpp:42
@@ -64,1 +41,3 @@
+    // The deleting dtor is installed in the vtable and deferred to the end of
+    // the TU.
   }
----------------
I don't like that the CHECKs are so far away from the code.
Is it possible to just add some extra DTORS line before the first one that was here?

e.g. add

  void last_function_in_TU() {}

at the end of the file?


http://llvm-reviews.chandlerc.com/D1066



More information about the cfe-commits mailing list