[PATCH] D1623: Support __builtin_ms_va_list.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 28 18:56:10 PDT 2015


rsmith added inline comments.

================
Comment at: lib/CodeGen/CGExprScalar.cpp:3387-3392
@@ -3386,4 +3386,8 @@
 
-  llvm::Value *ArgValue = CGF.EmitVAListRef(VE->getSubExpr());
-  llvm::Value *ArgPtr = CGF.EmitVAArg(ArgValue, VE->getType());
+  llvm::Value *ArgValue = VE->isMicrosoftABI() ?
+    CGF.EmitMSVAListRef(VE->getSubExpr()) :
+    CGF.EmitVAListRef(VE->getSubExpr());
+  llvm::Value *ArgPtr = VE->isMicrosoftABI() ?
+    CGF.EmitMSVAArg(ArgValue, VE->getType()) :
+    CGF.EmitVAArg(ArgValue, VE->getType());
   llvm::Type *ArgTy = ConvertType(VE->getType());
----------------
rsmith wrote:
> Do you really need this dispatch? `CodeGenFunction` dispatches this to the function's ABI info class, which should do the right thing already.
Hmm, scratch that, it's entirely possible for an MS VA list to get passed into a non-MS-ABI function and then to have __builtin_va_arg called on it.


http://reviews.llvm.org/D1623





More information about the cfe-commits mailing list