From 479e6fc7a734b4986bbedbc7ed8e0cdb163d835e Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 8 Apr 2009 23:13:16 +0000 Subject: [PATCH] Use the new EmitCallArgs function. No indented functionality change. llvm-svn: 68652 --- clang/lib/CodeGen/CGBlocks.cpp | 9 ++++----- clang/lib/CodeGen/CGCXX.cpp | 4 +--- clang/lib/CodeGen/CGExpr.cpp | 4 +--- clang/lib/CodeGen/CGObjC.cpp | 1 + 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 74b6af1425e4..a623cf18cf9b 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -435,16 +435,15 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) { CallArgList Args; Args.push_back(std::make_pair(RValue::get(BlockLiteral), VoidPtrTy)); + QualType FnType = BPT->getPointeeType(); + // And the rest of the arguments. - for (CallExpr::const_arg_iterator i = E->arg_begin(), e = E->arg_end(); - i != e; ++i) - Args.push_back(std::make_pair(EmitAnyExprToTemp(*i), - i->getType())); + EmitCallArgs(Args, FnType->getAsFunctionProtoType(), + E->arg_begin(), E->arg_end()); // Load the function. llvm::Value *Func = Builder.CreateLoad(FuncPtr, false, "tmp"); - QualType FnType = BPT->getPointeeType(); QualType ResultType = FnType->getAsFunctionType()->getResultType(); const CGFunctionInfo &FnInfo = diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 217f63a9df4e..24b4a2829930 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -166,9 +166,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) { Args.push_back(std::make_pair(RValue::get(BaseValue), MD->getThisType(getContext()))); - for (CallExpr::const_arg_iterator I = CE->arg_begin(), E = CE->arg_end(); - I != E; ++I) - Args.push_back(std::make_pair(EmitAnyExprToTemp(*I), I->getType())); + EmitCallArgs(Args, FPT, CE->arg_begin(), CE->arg_end()); QualType ResultType = MD->getType()->getAsFunctionType()->getResultType(); return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 4a7171ebd850..e1cb1d17ec0a 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1214,9 +1214,7 @@ RValue CodeGenFunction::EmitCallExpr(llvm::Value *Callee, QualType CalleeType, QualType ResultType = FnType->getAsFunctionType()->getResultType(); CallArgList Args; - for (CallExpr::const_arg_iterator I = ArgBeg; I != ArgEnd; ++I) - Args.push_back(std::make_pair(EmitAnyExprToTemp(*I), - I->getType())); + EmitCallArgs(Args, FnType->getAsFunctionProtoType(), ArgBeg, ArgEnd); return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), Callee, Args, TargetDecl); diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 4db29ce05d08..487da7a603db 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -79,6 +79,7 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) { Receiver = EmitScalarExpr(E->getReceiver()); } + // FIXME: This should use EmitCallArgs. CallArgList Args; for (CallExpr::const_arg_iterator i = E->arg_begin(), e = E->arg_end(); i != e; ++i) -- GitLab