diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 18 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 13 |
2 files changed, 19 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index f881e81bf45..af417963b1c 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1226,8 +1226,8 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, UsualUnaryConversions(FnExpr); Input.release(); - return Owned(new (Context)CXXOperatorCallExpr(FnExpr, Args, 2, ResultTy, - OpLoc)); + return Owned(new (Context) CXXOperatorCallExpr(Context, FnExpr, Args, 2, + ResultTy, OpLoc)); } else { // We matched a built-in operator. Convert the arguments, then // break out so that we will build the appropriate built-in @@ -1326,7 +1326,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, ExprArg Base, SourceLocation LLoc, Base.release(); Idx.release(); - return Owned(new (Context) CXXOperatorCallExpr(FnExpr, Args, 2, + return Owned(new (Context) CXXOperatorCallExpr(Context, FnExpr, Args, 2, ResultTy, LLoc)); } else { // We matched a built-in operator. Convert the arguments, then @@ -1850,7 +1850,7 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc, Dependent = true; if (Dependent) - return Owned(new (Context) CallExpr(Fn, Args, NumArgs, + return Owned(new (Context) CallExpr(Context, Fn, Args, NumArgs, Context.DependentTy, RParenLoc)); // Determine whether this is a call to an object (C++ [over.call.object]). @@ -1943,8 +1943,10 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc, // of arguments and function on error. // FIXME: Except that llvm::OwningPtr uses delete, when it really must be // Destroy(), or nothing gets cleaned up. - ExprOwningPtr<CallExpr> TheCall(this, new (Context) CallExpr(Fn, Args,NumArgs, - Context.BoolTy, RParenLoc)); + ExprOwningPtr<CallExpr> TheCall(this, new (Context) CallExpr(Context, Fn, + Args, NumArgs, + Context.BoolTy, + RParenLoc)); const FunctionType *FuncT; if (!Fn->getType()->isBlockPointerType()) { @@ -3795,7 +3797,7 @@ Action::OwningExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc, SourceLocation()); UsualUnaryConversions(FnExpr); - return Owned(new (Context) CXXOperatorCallExpr(FnExpr, Args, 2, + return Owned(new (Context) CXXOperatorCallExpr(Context, FnExpr, Args, 2, ResultTy, TokLoc)); } else { // We matched a built-in operator. Convert the arguments, then @@ -3897,7 +3899,7 @@ Action::OwningExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc, UsualUnaryConversions(FnExpr); input.release(); - return Owned(new (Context) CXXOperatorCallExpr(FnExpr, &Input, 1, + return Owned(new (Context) CXXOperatorCallExpr(Context, FnExpr, &Input, 1, ResultTy, OpLoc)); } else { // We matched a built-in operator. Convert the arguments, then diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 69bbf0e05ac..c91b507dc83 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -2123,7 +2123,11 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion, SourceLocation()); ImplicitCastExpr ConversionFn(Context.getPointerType(Conversion->getType()), &ConversionRef, false); - CallExpr Call(&ConversionFn, 0, 0, + + // Note that it is safe to allocate CallExpr on the stack here because + // there are 0 arguments (i.e., nothing is allocated using ASTContext's + // allocator). + CallExpr Call(Context, &ConversionFn, 0, 0, Conversion->getConversionType().getNonReferenceType(), SourceLocation()); ImplicitConversionSequence ICS = TryCopyInitialization(&Call, ToType, true); @@ -3648,7 +3652,8 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, assert(Method && "Member call to something that isn't a method?"); ExprOwningPtr<CXXMemberCallExpr> - TheCall(this, new (Context) CXXMemberCallExpr(MemExpr, Args, NumArgs, + TheCall(this, new (Context) CXXMemberCallExpr(Context, MemExpr, Args, + NumArgs, Method->getResultType().getNonReferenceType(), RParenLoc)); @@ -3815,7 +3820,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object, // owned. QualType ResultTy = Method->getResultType().getNonReferenceType(); ExprOwningPtr<CXXOperatorCallExpr> - TheCall(this, new (Context) CXXOperatorCallExpr(NewFn, MethodArgs, + TheCall(this, new (Context) CXXOperatorCallExpr(Context, NewFn, MethodArgs, NumArgs + 1, ResultTy, RParenLoc)); delete [] MethodArgs; @@ -3928,7 +3933,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, Expr *FnExpr = new (Context) DeclRefExpr(Method, Method->getType(), SourceLocation()); UsualUnaryConversions(FnExpr); - Base = new (Context) CXXOperatorCallExpr(FnExpr, &Base, 1, + Base = new (Context) CXXOperatorCallExpr(Context, FnExpr, &Base, 1, Method->getResultType().getNonReferenceType(), OpLoc); return ActOnMemberReferenceExpr(S, ExprArg(*this, Base), OpLoc, tok::arrow, |