[PATCH] MS ABI: Insert copy-constructors into the CatchableType

Reid Kleckner rnk at google.com
Fri Mar 6 10:45:42 PST 2015


================
Comment at: lib/AST/MicrosoftMangle.cpp:2313
@@ -2313,4 +2312,3 @@
   MicrosoftCXXNameMangler Mangler(*this, Out);
-  Mangler.getStream() << "_CT??_R0";
-  Mangler.mangleType(T, SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
-  Mangler.getStream() << "@8";
+  Mangler.getStream() << "_CT";
+
----------------
Does this get mangled to __CT... on 32-bit? Do we need \01?

================
Comment at: lib/AST/MicrosoftMangle.cpp:2315-2320
@@ +2314,8 @@
+
+  llvm::SmallString<64> RTTIMangling;
+  {
+    llvm::raw_svector_ostream Stream(RTTIMangling);
+    mangleCXXRTTI(T, Stream);
+  }
+  Mangler.getStream() << RTTIMangling.substr(1);
+
----------------
Stupid '\01' mangling. When we drop it, we can simply run the mangler on the Out stream.

================
Comment at: lib/AST/MicrosoftMangle.cpp:2325
@@ +2324,3 @@
+    llvm::raw_svector_ostream Stream(CopyCtorMangling);
+    mangleCXXCtor(CD, Ctor_Complete, Stream);
+  }
----------------
I guess the Microsoft mangler ignores the ctor type because there's only one. =D

================
Comment at: lib/Sema/SemaExprCXX.cpp:661
@@ +660,3 @@
+static void
+collectPublicBases(CXXRecordDecl *RD,
+                   llvm::DenseMap<CXXRecordDecl *, unsigned> &SubobjectsSeen,
----------------
Wee, more DFS.

================
Comment at: lib/Sema/SemaExprCXX.cpp:790-791
@@ +789,4 @@
+      if (CXXConstructorDecl *CD = LookupCopyingConstructor(Subobject, 0)) {
+        if (CD->isTrivial())
+          continue;
+        MarkFunctionReferenced(E->getExprLoc(), CD);
----------------
Huh, so previously I thought a null copy ctor entry meant the copy ctor was deleted, but I guess it actually means it's trivial. If you ever try to catch a type with a deleted copy ctor by value, we diagnose, so the runtime will never accidentally memcpy an uncopyable type.

http://reviews.llvm.org/D8101

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list