Skip to content

Commit 6066f47

Browse files
committed
Spare the last SmallVector
1 parent cef3544 commit 6066f47

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5637,15 +5637,13 @@ ExprResult Sema::BuiltinShuffleVector(CallExpr *TheCall) {
56375637
TheCall->setArg(I, ConstantExpr::Create(Context, Arg, APValue(*Result)));
56385638
}
56395639

5640-
SmallVector<Expr *> Exprs;
5641-
for (unsigned I = 0; I != NumArgs; I++) {
5642-
Exprs.push_back(TheCall->getArg(I));
5643-
TheCall->setArg(I, nullptr);
5644-
}
5640+
auto *Result = new (Context) ShuffleVectorExpr(
5641+
Context, ArrayRef(TheCall->getArgs(), NumArgs), ResType,
5642+
TheCall->getCallee()->getBeginLoc(), TheCall->getRParenLoc());
56455643

5646-
return new (Context) ShuffleVectorExpr(Context, Exprs, ResType,
5647-
TheCall->getCallee()->getBeginLoc(),
5648-
TheCall->getRParenLoc());
5644+
// All moved to Result.
5645+
TheCall->shrinkNumArgs(0);
5646+
return Result;
56495647
}
56505648

56515649
ExprResult Sema::ConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,

0 commit comments

Comments
 (0)