Skip to content
Snippets Groups Projects
Commit a4e5a821 authored by George Burgess IV's avatar George Burgess IV
Browse files

[Sema] Prefer SmallVector over `new`ed memory blocks. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289571 91177308-0d34-0410-b5e6-96231b3b80d8
parent 14f4b9d4
No related branches found
No related tags found
No related merge requests found
......@@ -12749,9 +12749,9 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
 
// Build the full argument list for the method call (the implicit object
// parameter is placed at the beginning of the list).
std::unique_ptr<Expr * []> MethodArgs(new Expr *[Args.size() + 1]);
SmallVector<Expr *, 8> MethodArgs(Args.size() + 1);
MethodArgs[0] = Object.get();
std::copy(Args.begin(), Args.end(), &MethodArgs[1]);
std::copy(Args.begin(), Args.end(), MethodArgs.begin() + 1);
 
// Once we've built TheCall, all of the expressions are properly
// owned.
......@@ -12760,10 +12760,8 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
ResultTy = ResultTy.getNonLValueExprType(Context);
 
CXXOperatorCallExpr *TheCall = new (Context)
CXXOperatorCallExpr(Context, OO_Call, NewFn.get(),
llvm::makeArrayRef(MethodArgs.get(), Args.size() + 1),
ResultTy, VK, RParenLoc, false);
MethodArgs.reset();
CXXOperatorCallExpr(Context, OO_Call, NewFn.get(), MethodArgs, ResultTy,
VK, RParenLoc, false);
 
if (CheckCallReturnType(Method->getReturnType(), LParenLoc, TheCall, Method))
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment