Author: gbiv Date: Tue Dec 13 13:22:56 2016 New Revision: 289571 URL: http://llvm.org/viewvc/llvm-project?rev=289571&view=rev Log: [Sema] Prefer SmallVector over `new`ed memory blocks. NFC.
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp Modified: cfe/trunk/lib/Sema/SemaOverload.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=289571&r1=289570&r2=289571&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaOverload.cpp (original) +++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Dec 13 13:22:56 2016 @@ -12749,9 +12749,9 @@ Sema::BuildCallToObjectOfClassType(Scope // 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 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits