mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix a couple cases of ArrayRef capturing compiler temps.
Use a SmallVector for scratch space to use to build the ArrayRefs instead.
This commit is contained in:
@@ -6143,12 +6143,17 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
|
|||||||
ArrayRef<Expr *> arguments;
|
ArrayRef<Expr *> arguments;
|
||||||
ArrayRef<TypeBase *> types;
|
ArrayRef<TypeBase *> types;
|
||||||
|
|
||||||
|
SmallVector<Expr *, 1> Scratch;
|
||||||
if (auto *TE = dyn_cast<TupleExpr>(CEA))
|
if (auto *TE = dyn_cast<TupleExpr>(CEA))
|
||||||
arguments = TE->getElements();
|
arguments = TE->getElements();
|
||||||
else if (auto *PE = dyn_cast<ParenExpr>(CEA))
|
else if (auto *PE = dyn_cast<ParenExpr>(CEA)) {
|
||||||
arguments = PE->getSubExpr();
|
Scratch.push_back(PE->getSubExpr());
|
||||||
else
|
arguments = makeArrayRef(Scratch);
|
||||||
arguments = apply->getArg();
|
}
|
||||||
|
else {
|
||||||
|
Scratch.push_back(apply->getArg());
|
||||||
|
arguments = makeArrayRef(Scratch);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto arg: arguments) {
|
for (auto arg: arguments) {
|
||||||
bool isNoEscape = false;
|
bool isNoEscape = false;
|
||||||
|
|||||||
@@ -299,12 +299,17 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
|
|||||||
|
|
||||||
// The argument is either a ParenExpr or TupleExpr.
|
// The argument is either a ParenExpr or TupleExpr.
|
||||||
ArrayRef<Expr*> arguments;
|
ArrayRef<Expr*> arguments;
|
||||||
|
SmallVector<Expr *, 1> Scratch;
|
||||||
if (auto *TE = dyn_cast<TupleExpr>(Arg))
|
if (auto *TE = dyn_cast<TupleExpr>(Arg))
|
||||||
arguments = TE->getElements();
|
arguments = TE->getElements();
|
||||||
else if (auto *PE = dyn_cast<ParenExpr>(Arg))
|
else if (auto *PE = dyn_cast<ParenExpr>(Arg)) {
|
||||||
arguments = PE->getSubExpr();
|
Scratch.push_back(PE->getSubExpr());
|
||||||
else
|
arguments = makeArrayRef(Scratch);
|
||||||
arguments = Call->getArg();
|
}
|
||||||
|
else {
|
||||||
|
Scratch.push_back(Call->getArg());
|
||||||
|
arguments = makeArrayRef(Scratch);
|
||||||
|
}
|
||||||
|
|
||||||
// Check each argument.
|
// Check each argument.
|
||||||
for (auto arg : arguments) {
|
for (auto arg : arguments) {
|
||||||
|
|||||||
Reference in New Issue
Block a user