Skip to content

Commit ce51059

Browse files
committed
NFC: [OSSACompleteLifetime] Allow forced verifying
1 parent cb0dafb commit ce51059

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

include/swift/SIL/OSSALifetimeCompletion.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,20 @@ class OSSALifetimeCompletion {
5757
/// Extend trivial variables for lifetime diagnostics (only in SILGenCleanup).
5858
HandleTrivialVariable_t handleTrivialVariable;
5959

60+
/// Whether verification of the computed liveness should be run even when the
61+
/// global setting is off.
62+
/// TODO: Remove this option.
63+
bool ForceLivenessVerification;
64+
6065
public:
61-
OSSALifetimeCompletion(SILFunction *function, const DominanceInfo *domInfo,
62-
DeadEndBlocks &deadEndBlocks,
63-
HandleTrivialVariable_t handleTrivialVariable = IgnoreTrivialVariable)
66+
OSSALifetimeCompletion(
67+
SILFunction *function, const DominanceInfo *domInfo,
68+
DeadEndBlocks &deadEndBlocks,
69+
HandleTrivialVariable_t handleTrivialVariable = IgnoreTrivialVariable,
70+
bool forceLivenessVerification = false)
6471
: domInfo(domInfo), deadEndBlocks(deadEndBlocks),
65-
completedValues(function), handleTrivialVariable(handleTrivialVariable) {}
72+
completedValues(function), handleTrivialVariable(handleTrivialVariable),
73+
ForceLivenessVerification(forceLivenessVerification) {}
6674

6775
/// The kind of boundary at which to complete the lifetime.
6876
///

lib/SIL/Utils/OSSALifetimeCompletion.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,9 @@ bool OSSALifetimeCompletion::analyzeAndUpdateLifetime(
501501
};
502502
Walker walker(*this, scopedAddress, boundary, liveness);
503503
AddressUseKind result = walker.walk(scopedAddress.value);
504-
if (VerifyLifetimeCompletion && boundary != Boundary::Availability
505-
&& result != AddressUseKind::NonEscaping) {
504+
if ((VerifyLifetimeCompletion || ForceLivenessVerification) &&
505+
boundary != Boundary::Availability &&
506+
result != AddressUseKind::NonEscaping) {
506507
llvm::errs() << "Incomplete liveness for:\n" << scopedAddress.value;
507508
if (auto *escapingUse = walker.getEscapingUse()) {
508509
llvm::errs() << " escapes at:\n";

0 commit comments

Comments
 (0)