mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] ExpressionTimer: Simplify locators only if allotted time has been exceeded
This commit is contained in:
@@ -76,6 +76,11 @@ ExpressionTimer::~ExpressionTimer() {
|
||||
if (!PrintWarning)
|
||||
return;
|
||||
|
||||
const auto WarnLimit = getWarnLimit();
|
||||
|
||||
if (WarnLimit == 0 || elapsedMS < WarnLimit)
|
||||
return;
|
||||
|
||||
ASTNode anchor;
|
||||
if (auto *locator = Anchor.dyn_cast<ConstraintLocator *>()) {
|
||||
anchor = simplifyLocatorToAnchor(locator);
|
||||
@@ -87,9 +92,7 @@ ExpressionTimer::~ExpressionTimer() {
|
||||
anchor = Anchor.get<Expr *>();
|
||||
}
|
||||
|
||||
const auto WarnLimit = getWarnLimit();
|
||||
if (WarnLimit != 0 && elapsedMS >= WarnLimit &&
|
||||
anchor.getStartLoc().isValid()) {
|
||||
if (anchor.getStartLoc().isValid()) {
|
||||
Context.Diags
|
||||
.diagnose(anchor.getStartLoc(), diag::debug_long_expression, elapsedMS,
|
||||
WarnLimit)
|
||||
|
||||
Reference in New Issue
Block a user