[PATCH] [ms-cxxabi] Construct and destroy call arguments in the correct order

Richard Smith richard at metafoo.co.uk
Mon Dec 2 17:54:06 PST 2013



================
Comment at: lib/CodeGen/CGBlocks.cpp:961-970
@@ -960,4 +960,12 @@
   // And the rest of the arguments.
-  EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(),
-               E->arg_begin(), E->arg_end());
+  bool AllowExtraArgs = true;
+  FunctionProtoType::arg_type_iterator ArgTyBeg = 0, ArgTyEnd = 0;
+  const FunctionProtoType *FPT = FnType->getAs<FunctionProtoType>();
+  if (FPT) {
+    AllowExtraArgs = FPT->isVariadic();
+    ArgTyBeg = FPT->arg_type_begin();
+    ArgTyEnd = FPT->arg_type_end();
+  }
+  EmitCallArgs(Args, AllowExtraArgs, ArgTyBeg, ArgTyEnd, E->arg_begin(),
+               E->arg_end());
 
----------------
This change looks unnecessary.

================
Comment at: lib/CodeGen/CGObjC.cpp:376-387
@@ -375,3 +375,14 @@
   CallArgList Args;
-  EmitCallArgs(Args, method, E->arg_begin(), E->arg_end());
+  bool AllowExtraArgs = true;
+  ObjCMethodDecl::arg_type_iterator ArgTyBeg(
+      0, ObjCMethodDecl::deref_fun(&ParmVarDecl::getType));
+  ObjCMethodDecl::arg_type_iterator ArgTyEnd(
+      0, ObjCMethodDecl::deref_fun(&ParmVarDecl::getType));
+  if (method) {
+    AllowExtraArgs = method->isVariadic();
+    ArgTyBeg = method->arg_type_begin();
+    ArgTyEnd = method->arg_type_end();
+  }
+  EmitCallArgs(Args, AllowExtraArgs, ArgTyBeg, ArgTyEnd, E->arg_begin(),
+               E->arg_end());
 
----------------
This change looks like it would be redundant if you turned the old form of `EmitCallArgs` back into a template.


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



More information about the cfe-commits mailing list