Skip to content

Commit 3efb948

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 eee40b4 commit 3efb948

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
@@ -1964,6 +1964,9 @@ enum class ConstraintSystemFlags {
19641964

19651965
/// Disable macro expansions.
19661966
DisableMacroExpansions = 0x80,
1967+
1968+
/// Enable old type-checker performance hacks.
1969+
EnablePerformanceHacks = 0x100,
19671970
};
19681971

19691972
/// Options that affect the constraint system as a whole.
@@ -3604,10 +3607,9 @@ class ConstraintSystem {
36043607
}
36053608

36063609
/// Check whether old type-checker performance hacks has been explicitly
3607-
/// enabled by a flag.
3610+
/// enabled.
36083611
bool performanceHacksEnabled() const {
3609-
return getASTContext()
3610-
.TypeCheckerOpts.EnableConstraintSolverPerformanceHacks;
3612+
return Options.contains(ConstraintSystemFlags::EnablePerformanceHacks);
36113613
}
36123614

36133615
/// 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)