[PATCH] MS ABI: Implement copy-ctor closures, finish implementing throw

David Majnemer david.majnemer at gmail.com
Tue Mar 10 15:38:46 PDT 2015


================
Comment at: lib/AST/MicrosoftMangle.cpp:790
@@ -776,1 +789,3 @@
+      } else {
+        Out << "?0";
       }
----------------
rnk wrote:
> Keep the Ctor_Complete assertion to avoid decl mangling collisions?
That assertion was never like because `Structor` was always null for constructors.  This assertion is actually wrong in practice because Ctor_Base can happen and weakening the assertion doesn't seem very useful.

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:3332-3335
@@ +3331,6 @@
+    CallingConv ActualCallingConv = CD->getType()
+                                        ->getCanonicalTypeUnqualified()
+                                        .getAs<FunctionProtoType>()
+                                        ->getExtInfo()
+                                        .getCC();
+    if (ExpectedCallingConv != ActualCallingConv || CD->getNumParams() != 1)
----------------
rnk wrote:
> Surely this can be:
>   CD->getType()->getAs<FunctionType>()->getCallConv()?
> 
> Does the canonical unqualified type step matter in practice?
Done.

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:3336
@@ +3335,3 @@
+                                        .getCC();
+    if (ExpectedCallingConv != ActualCallingConv || CD->getNumParams() != 1)
+      CT = Ctor_Closure;
----------------
rnk wrote:
> Can you test the calling convention difference case and the variadic case?
The different calling convention case is the variadic case.

A test for the variadic case has been added.

================
Comment at: lib/Sema/SemaExprCXX.cpp:829
@@ -793,1 +828,3 @@
+            BuildCXXDefaultArgExpr(ThrowLoc, CD, CD->getParamDecl(I)).get();
+        Context.addDefaultArgExprForConstructor(CD, I, DefaultArg);
       }
----------------
rnk wrote:
> I can see that you need to call BuildCXXDefautlArgExpr to do all the necessary semantic checking, but is it really necessary to maintain a map of all the CXXDefaultArgExprs, rather than simply calling ParmVarDecl::getDefaultArgExpr() during CodeGen?
Yes because the we won't have an instantiated default argument at CodeGen-time, just the dependent one which won't be suitable.

http://reviews.llvm.org/D8225

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






More information about the cfe-commits mailing list