mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[move-only] Combine the address/object checker in the same pass so that we only run cleanups once.
Otherwise, sometimes when the object checker emits a diagnostic and cleans up the IR, some of the cleaned up copies are copies that should have been handled by the address checker. The end result is that the address checker does not emit diagnostics for that IR. I found this problem was exascerbated when writing code for escaping closures. This commit also cleans up the passes in preparation for at a future time moving some of the transformations into the utils folder.
This commit is contained in:
@@ -196,6 +196,8 @@ void DiagnosticEmitter::emitObjectGuaranteedDiagnostic(
|
||||
if (!getCanonicalizer().hasNonPartialApplyConsumingUse())
|
||||
return;
|
||||
|
||||
registerDiagnosticEmitted(markedValue);
|
||||
|
||||
// Check if this value is closure captured. In such a case, emit a special
|
||||
// error.
|
||||
if (auto *fArg = dyn_cast<SILFunctionArgument>(
|
||||
@@ -215,11 +217,12 @@ void DiagnosticEmitter::emitObjectGuaranteedDiagnostic(
|
||||
diag::sil_moveonlychecker_guaranteed_value_consumed, varName);
|
||||
|
||||
emitObjectDiagnosticsForGuaranteedUses(true /*ignore partial apply uses*/);
|
||||
registerDiagnosticEmitted(markedValue);
|
||||
}
|
||||
|
||||
void DiagnosticEmitter::emitObjectOwnedDiagnostic(
|
||||
MarkMustCheckInst *markedValue) {
|
||||
registerDiagnosticEmitted(markedValue);
|
||||
|
||||
auto &astContext = fn->getASTContext();
|
||||
SmallString<64> varName;
|
||||
getVariableNameForValue(markedValue, varName);
|
||||
@@ -339,8 +342,6 @@ void DiagnosticEmitter::emitObjectOwnedDiagnostic(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
registerDiagnosticEmitted(markedValue);
|
||||
}
|
||||
|
||||
void DiagnosticEmitter::emitObjectDiagnosticsForGuaranteedUses(
|
||||
|
||||
Reference in New Issue
Block a user