Author: rsmith Date: Tue May 7 18:36:36 2019 New Revision: 360217 URL: http://llvm.org/viewvc/llvm-project?rev=360217&view=rev Log: Split ActOnCallExpr into an ActOnCallExpr to be called by the parser, and a BuildCallExpr to be called internally within Sema to build / rebuild calls.
Modified: cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/Sema.cpp cfe/trunk/lib/Sema/SemaCUDA.cpp cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/lib/Sema/SemaCoroutine.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/lib/Sema/SemaPseudoObject.cpp cfe/trunk/lib/Sema/TreeTransform.h Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Tue May 7 18:36:36 2019 @@ -4492,6 +4492,9 @@ public: /// locations. ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, + Expr *ExecConfig = nullptr); + ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, + MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig = nullptr, bool IsExecConfig = false); ExprResult Modified: cfe/trunk/lib/Sema/Sema.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/Sema.cpp (original) +++ cfe/trunk/lib/Sema/Sema.cpp Tue May 7 18:36:36 2019 @@ -2060,7 +2060,7 @@ bool Sema::tryToRecoverWithCall(ExprResu // FIXME: Try this before emitting the fixit, and suppress diagnostics // while doing so. - E = ActOnCallExpr(nullptr, E.get(), Range.getEnd(), None, + E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), None, Range.getEnd().getLocWithOffset(1)); return true; } Modified: cfe/trunk/lib/Sema/SemaCUDA.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCUDA.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaCUDA.cpp (original) +++ cfe/trunk/lib/Sema/SemaCUDA.cpp Tue May 7 18:36:36 2019 @@ -50,7 +50,7 @@ ExprResult Sema::ActOnCUDAExecConfigExpr DeclRefExpr(Context, ConfigDecl, false, ConfigQTy, VK_LValue, LLLLoc); MarkFunctionReferenced(LLLLoc, ConfigDecl); - return ActOnCallExpr(S, ConfigDR, LLLLoc, ExecConfig, GGGLoc, nullptr, + return BuildCallExpr(S, ConfigDR, LLLLoc, ExecConfig, GGGLoc, nullptr, /*IsExecConfig=*/true); } Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue May 7 18:36:36 2019 @@ -4885,7 +4885,7 @@ static bool checkBuiltinArgument(Sema &S /// We have a call to a function like __sync_fetch_and_add, which is an /// overloaded function based on the pointer type of its first argument. -/// The main ActOnCallExpr routines have already promoted the types of +/// The main BuildCallExpr routines have already promoted the types of /// arguments because all of these calls are prototyped as void(...). /// /// This function goes through and does final semantic checking for these Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original) +++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Tue May 7 18:36:36 2019 @@ -312,7 +312,7 @@ static Expr *buildBuiltinCall(Sema &S, S assert(DeclRef.isUsable() && "Builtin reference cannot fail"); ExprResult Call = - S.ActOnCallExpr(/*Scope=*/nullptr, DeclRef.get(), Loc, CallArgs, Loc); + S.BuildCallExpr(/*Scope=*/nullptr, DeclRef.get(), Loc, CallArgs, Loc); assert(!Call.isInvalid() && "Call to builtin cannot fail!"); return Call.get(); @@ -342,7 +342,7 @@ static ExprResult buildCoroutineHandle(S if (FromAddr.isInvalid()) return ExprError(); - return S.ActOnCallExpr(nullptr, FromAddr.get(), Loc, FramePtr, Loc); + return S.BuildCallExpr(nullptr, FromAddr.get(), Loc, FramePtr, Loc); } struct ReadySuspendResumeResult { @@ -374,7 +374,7 @@ static ExprResult buildMemberCall(Sema & return ExprError(); } - return S.ActOnCallExpr(nullptr, Result.get(), Loc, Args, Loc, nullptr); + return S.BuildCallExpr(nullptr, Result.get(), Loc, Args, Loc, nullptr); } // See if return type is coroutine-handle and if so, invoke builtin coro-resume @@ -1105,7 +1105,7 @@ bool CoroutineStmtBuilder::makeReturnOnA return false; ExprResult ReturnObjectOnAllocationFailure = - S.ActOnCallExpr(nullptr, DeclNameExpr.get(), Loc, {}, Loc); + S.BuildCallExpr(nullptr, DeclNameExpr.get(), Loc, {}, Loc); if (ReturnObjectOnAllocationFailure.isInvalid()) return false; @@ -1268,7 +1268,7 @@ bool CoroutineStmtBuilder::makeNewAndDel NewArgs.push_back(Arg); ExprResult NewExpr = - S.ActOnCallExpr(S.getCurScope(), NewRef.get(), Loc, NewArgs, Loc); + S.BuildCallExpr(S.getCurScope(), NewRef.get(), Loc, NewArgs, Loc); NewExpr = S.ActOnFinishFullExpr(NewExpr.get(), /*DiscardedValue*/ false); if (NewExpr.isInvalid()) return false; @@ -1294,7 +1294,7 @@ bool CoroutineStmtBuilder::makeNewAndDel DeleteArgs.push_back(FrameSize); ExprResult DeleteExpr = - S.ActOnCallExpr(S.getCurScope(), DeleteRef.get(), Loc, DeleteArgs, Loc); + S.BuildCallExpr(S.getCurScope(), DeleteRef.get(), Loc, DeleteArgs, Loc); DeleteExpr = S.ActOnFinishFullExpr(DeleteExpr.get(), /*DiscardedValue*/ false); if (DeleteExpr.isInvalid()) Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue May 7 18:36:36 2019 @@ -1158,7 +1158,7 @@ static bool checkTupleLikeDecomposition( if (E.isInvalid()) return true; - E = S.ActOnCallExpr(nullptr, E.get(), Loc, None, Loc); + E = S.BuildCallExpr(nullptr, E.get(), Loc, None, Loc); } else { // Otherwise, the initializer is get<i-1>(e), where get is looked up // in the associated namespaces. @@ -1168,7 +1168,7 @@ static bool checkTupleLikeDecomposition( UnresolvedSetIterator(), UnresolvedSetIterator()); Expr *Arg = E.get(); - E = S.ActOnCallExpr(nullptr, Get, Loc, Arg, Loc); + E = S.BuildCallExpr(nullptr, Get, Loc, Arg, Loc); } if (E.isInvalid()) return true; @@ -11562,7 +11562,7 @@ buildMemcpyForAssignmentOp(Sema &S, Sour Expr *CallArgs[] = { To, From, IntegerLiteral::Create(S.Context, Size, SizeType, Loc) }; - ExprResult Call = S.ActOnCallExpr(/*Scope=*/nullptr, MemCpyRef.get(), + ExprResult Call = S.BuildCallExpr(/*Scope=*/nullptr, MemCpyRef.get(), Loc, CallArgs, Loc); assert(!Call.isInvalid() && "Call to __builtin_memcpy cannot fail!"); Modified: cfe/trunk/lib/Sema/SemaExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue May 7 18:36:36 2019 @@ -917,7 +917,7 @@ ExprResult Sema::DefaultVariadicArgument if (TrapFn.isInvalid()) return ExprError(); - ExprResult Call = ActOnCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), + ExprResult Call = BuildCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), None, E->getEndLoc()); if (Call.isInvalid()) return ExprError(); @@ -5515,10 +5515,16 @@ tryImplicitlyCaptureThisIfImplicitMember } } -/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments. +ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc, + MultiExprArg ArgExprs, SourceLocation RParenLoc, + Expr *ExecConfig) { + return BuildCallExpr(Scope, Fn, LParenLoc, ArgExprs, RParenLoc, ExecConfig); +} + +/// BuildCallExpr - Handle a call to Fn with the specified array of arguments. /// This provides the location of the left/right parens and a list of comma /// locations. -ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc, +ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig, bool IsExecConfig) { // Since this might be a postfix expression, get rid of ParenListExprs. Modified: cfe/trunk/lib/Sema/SemaOverload.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaOverload.cpp (original) +++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue May 7 18:36:36 2019 @@ -11995,7 +11995,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Sco // This shouldn't cause an infinite loop because we're giving it // an expression with viable lookup results, which should never // end up here. - return SemaRef.ActOnCallExpr(/*Scope*/ nullptr, NewFn.get(), LParenLoc, + return SemaRef.BuildCallExpr(/*Scope*/ nullptr, NewFn.get(), LParenLoc, MultiExprArg(Args.data(), Args.size()), RParenLoc); } @@ -13304,7 +13304,7 @@ Sema::BuildCallToObjectOfClassType(Scope "Found Decl & conversion-to-functionptr should be same, right?!"); // We selected one of the surrogate functions that converts the // object parameter to a function pointer. Perform the conversion - // on the object argument, then let ActOnCallExpr finish the job. + // on the object argument, then let BuildCallExpr finish the job. // Create an implicit member expr to refer to the conversion operator. // and then call it. @@ -13317,7 +13317,7 @@ Sema::BuildCallToObjectOfClassType(Scope CK_UserDefinedConversion, Call.get(), nullptr, VK_RValue); - return ActOnCallExpr(S, Call.get(), LParenLoc, Args, RParenLoc); + return BuildCallExpr(S, Call.get(), LParenLoc, Args, RParenLoc); } CheckMemberOperatorAccess(LParenLoc, Object.get(), nullptr, Best->FoundDecl); @@ -13656,7 +13656,7 @@ Sema::BuildForRangeBeginEndCall(SourceLo *CallExpr = ExprError(); return FRS_DiagnosticIssued; } - *CallExpr = ActOnCallExpr(S, MemberRef.get(), Loc, None, Loc, nullptr); + *CallExpr = BuildCallExpr(S, MemberRef.get(), Loc, None, Loc, nullptr); if (CallExpr->isInvalid()) { *CallExpr = ExprError(); return FRS_DiagnosticIssued; Modified: cfe/trunk/lib/Sema/SemaPseudoObject.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaPseudoObject.cpp?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaPseudoObject.cpp (original) +++ cfe/trunk/lib/Sema/SemaPseudoObject.cpp Tue May 7 18:36:36 2019 @@ -1491,7 +1491,7 @@ ExprResult MSPropertyOpBuilder::buildGet return ExprError(); } - return S.ActOnCallExpr(S.getCurScope(), GetterExpr.get(), + return S.BuildCallExpr(S.getCurScope(), GetterExpr.get(), RefExpr->getSourceRange().getBegin(), CallArgs, RefExpr->getSourceRange().getEnd()); } @@ -1523,7 +1523,7 @@ ExprResult MSPropertyOpBuilder::buildSet SmallVector<Expr*, 4> ArgExprs; ArgExprs.append(CallArgs.begin(), CallArgs.end()); ArgExprs.push_back(op); - return S.ActOnCallExpr(S.getCurScope(), SetterExpr.get(), + return S.BuildCallExpr(S.getCurScope(), SetterExpr.get(), RefExpr->getSourceRange().getBegin(), ArgExprs, op->getSourceRange().getEnd()); } Modified: cfe/trunk/lib/Sema/TreeTransform.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=360217&r1=360216&r2=360217&view=diff ============================================================================== --- cfe/trunk/lib/Sema/TreeTransform.h (original) +++ cfe/trunk/lib/Sema/TreeTransform.h Tue May 7 18:36:36 2019 @@ -2267,8 +2267,8 @@ public: MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig = nullptr) { - return getSema().ActOnCallExpr(/*Scope=*/nullptr, Callee, LParenLoc, - Args, RParenLoc, ExecConfig); + return getSema().BuildCallExpr(/*Scope=*/nullptr, Callee, LParenLoc, Args, + RParenLoc, ExecConfig); } /// Build a new member access expression. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits