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:
@@ -249,6 +249,8 @@ private:
|
||||
bool PrintWarning;
|
||||
|
||||
public:
|
||||
const static unsigned NoLimit = (unsigned) -1;
|
||||
|
||||
ExpressionTimer(AnchorType Anchor, ConstraintSystem &CS,
|
||||
unsigned thresholdInSecs);
|
||||
|
||||
@@ -274,6 +276,9 @@ public:
|
||||
/// Return the remaining process time in seconds until the
|
||||
/// threshold specified during construction is reached.
|
||||
unsigned getRemainingProcessTimeInSeconds() const {
|
||||
if (ThresholdInSecs == NoLimit)
|
||||
return NoLimit;
|
||||
|
||||
auto elapsed = unsigned(getElapsedProcessTimeInFractionalSeconds());
|
||||
return elapsed >= ThresholdInSecs ? 0 : ThresholdInSecs - elapsed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user