Skip to content

Commit 22b2a6f

Browse files
committed
[ConstraintSystem] Add a option to re-enable performance hacks
Instead of checking `EnableConstraintSolverPerformanceHacks` directly, let's use an option which is easier to set i.e. when a block list is implemented.
1 parent 0c0b527 commit 22b2a6f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,9 @@ enum class ConstraintSystemFlags {
19591959

19601960
/// Disable macro expansions.
19611961
DisableMacroExpansions = 0x80,
1962+
1963+
/// Enable old type-checker performance hacks.
1964+
EnablePerformanceHacks = 0x100,
19621965
};
19631966

19641967
/// Options that affect the constraint system as a whole.
@@ -3599,10 +3602,9 @@ class ConstraintSystem {
35993602
}
36003603

36013604
/// Check whether old type-checker performance hacks has been explicitly
3602-
/// enabled by a flag.
3605+
/// enabled.
36033606
bool performanceHacksEnabled() const {
3604-
return getASTContext()
3605-
.TypeCheckerOpts.EnableConstraintSolverPerformanceHacks;
3607+
return Options.contains(ConstraintSystemFlags::EnablePerformanceHacks);
36063608
}
36073609

36083610
/// Log and record the application of the fix. Return true iff any

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ TypeChecker::typeCheckTarget(SyntacticElementTarget &target,
466466
if (options.contains(TypeCheckExprFlags::DisableMacroExpansions))
467467
csOptions |= ConstraintSystemFlags::DisableMacroExpansions;
468468

469+
if (Context.TypeCheckerOpts.EnableConstraintSolverPerformanceHacks)
470+
csOptions |= ConstraintSystemFlags::EnablePerformanceHacks;
471+
469472
ConstraintSystem cs(dc, csOptions, diagnosticTransaction);
470473

471474
if (auto *expr = target.getAsExpr()) {

0 commit comments

Comments
 (0)