mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Fix -warn-long-expression-type-checking when expression timer is turned off
My change 983b75e1cf broke
-warn-long-expression-type-checking because now the
ExpressionTimer is not instantiated by default and that
entire code path is skipped.
Change it so that if -warn-long-expression-type-checking
is passed in, we still start the timer, we just don't
ever consider it to have 'expired'.
Fixes rdar://problem/152998878.
This commit is contained in:
@@ -141,9 +141,18 @@ ConstraintSystem::~ConstraintSystem() {
|
||||
void ConstraintSystem::startExpressionTimer(ExpressionTimer::AnchorType anchor) {
|
||||
ASSERT(!Timer);
|
||||
|
||||
unsigned timeout = getASTContext().TypeCheckerOpts.ExpressionTimeoutThreshold;
|
||||
if (timeout == 0)
|
||||
return;
|
||||
const auto &opts = getASTContext().TypeCheckerOpts;
|
||||
unsigned timeout = opts.ExpressionTimeoutThreshold;
|
||||
|
||||
// If either the timeout is set, or we're asked to emit warnings,
|
||||
// start the timer. Otherwise, don't start the timer, it's needless
|
||||
// overhead.
|
||||
if (timeout == 0) {
|
||||
if (opts.WarnLongExpressionTypeChecking == 0)
|
||||
return;
|
||||
|
||||
timeout = ExpressionTimer::NoLimit;
|
||||
}
|
||||
|
||||
Timer.emplace(anchor, *this, timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user