Skip to content

Commit 503774e

Browse files
committed
[gardening] Standardize usage of auto in if-dyncast pattern in cleanupCalleeValue.
The if-dyncast pattern is this construct: (1) if (auto *x = dyn_cast<SILInstruction>(f)). In this function, we were sometimes using 'auto *' and othertimes we were writing out the full type. This commit standardizes on 'auto *'.
1 parent 3e46ab6 commit 503774e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ cleanupCalleeValue(SILValue CalleeValue, ArrayRef<SILValue> CaptureArgs,
110110
ArrayRef<SILValue> FullArgs) {
111111
SmallVector<SILInstruction*, 16> InstsToDelete;
112112
for (SILValue V : FullArgs) {
113-
if (SILInstruction *I = dyn_cast<SILInstruction>(V))
113+
if (auto *I = dyn_cast<SILInstruction>(V))
114114
if (I != CalleeValue &&
115115
isInstructionTriviallyDead(I))
116116
InstsToDelete.push_back(I);
117117
}
118118
recursivelyDeleteTriviallyDeadInstructions(InstsToDelete, true);
119119

120120
// Handle the case where the callee of the apply is a load instruction.
121-
if (LoadInst *LI = dyn_cast<LoadInst>(CalleeValue)) {
121+
if (auto *LI = dyn_cast<LoadInst>(CalleeValue)) {
122122
auto *PBI = cast<ProjectBoxInst>(LI->getOperand());
123123
auto *ABI = cast<AllocBoxInst>(PBI->getOperand());
124124

@@ -183,7 +183,7 @@ cleanupCalleeValue(SILValue CalleeValue, ArrayRef<SILValue> CaptureArgs,
183183
CalleeValue = Callee;
184184
}
185185

186-
if (FunctionRefInst *FRI = dyn_cast<FunctionRefInst>(CalleeValue)) {
186+
if (auto *FRI = dyn_cast<FunctionRefInst>(CalleeValue)) {
187187
if (!FRI->use_empty())
188188
return;
189189
FRI->eraseFromParent();

0 commit comments

Comments
 (0)