Skip to content

Commit 4f0cf9d

Browse files
authored
Merge pull request #83093 from hamishknight/limits
[swift-ide-test] Add solver limit options
2 parents 5d66fda + 7cbe8a8 commit 4f0cf9d

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,21 @@ static llvm::cl::opt<bool> DebugConstraintSolver("debug-constraints",
774774
llvm::cl::desc("Enable verbose debugging from the constraint solver."),
775775
llvm::cl::cat(Category));
776776

777+
static llvm::cl::opt<unsigned>
778+
SolverMemoryThreshold("solver-memory-threshold",
779+
llvm::cl::desc("Set the memory threshold for constraint solving."),
780+
llvm::cl::cat(Category), llvm::cl::init(0));
781+
782+
static llvm::cl::opt<unsigned>
783+
SolverScopeThreshold("solver-scope-threshold",
784+
llvm::cl::desc("Set the solver scope threshold for constraint solving."),
785+
llvm::cl::cat(Category), llvm::cl::init(0));
786+
787+
static llvm::cl::opt<unsigned>
788+
SolverTrailThreshold("solver-trail-threshold",
789+
llvm::cl::desc("Set the solver trail threshold for constraint solving."),
790+
llvm::cl::cat(Category), llvm::cl::init(0));
791+
777792
static llvm::cl::opt<bool>
778793
IncludeLocals("include-locals", llvm::cl::desc("Index local symbols too."),
779794
llvm::cl::cat(Category), llvm::cl::init(false));
@@ -4556,12 +4571,19 @@ int main(int argc, char *argv[]) {
45564571
}
45574572
InitInvok.getLangOptions().EnableObjCAttrRequiresFoundation =
45584573
!options::DisableObjCAttrRequiresFoundationModule;
4559-
for (auto prefix : options::DebugForbidTypecheckPrefix) {
4560-
InitInvok.getTypeCheckerOptions().DebugForbidTypecheckPrefixes.push_back(
4561-
prefix);
4562-
}
4563-
InitInvok.getTypeCheckerOptions().DebugConstraintSolver =
4564-
options::DebugConstraintSolver;
4574+
4575+
auto &TypeCheckOpts = InitInvok.getTypeCheckerOptions();
4576+
for (auto prefix : options::DebugForbidTypecheckPrefix)
4577+
TypeCheckOpts.DebugForbidTypecheckPrefixes.push_back(prefix);
4578+
4579+
TypeCheckOpts.DebugConstraintSolver = options::DebugConstraintSolver;
4580+
4581+
if (auto &memLimit = options::SolverMemoryThreshold)
4582+
TypeCheckOpts.SolverMemoryThreshold = memLimit;
4583+
if (auto &scopeLimit = options::SolverScopeThreshold)
4584+
TypeCheckOpts.SolverScopeThreshold = scopeLimit;
4585+
if (auto &trailLimit = options::SolverTrailThreshold)
4586+
TypeCheckOpts.SolverTrailThreshold = trailLimit;
45654587

45664588
for (auto ConfigName : options::BuildConfigs)
45674589
InitInvok.getLangOptions().addCustomConditionalCompilationFlag(ConfigName);

0 commit comments

Comments
 (0)