@@ -774,6 +774,21 @@ static llvm::cl::opt<bool> DebugConstraintSolver("debug-constraints",
774
774
llvm::cl::desc (" Enable verbose debugging from the constraint solver." ),
775
775
llvm::cl::cat(Category));
776
776
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
+
777
792
static llvm::cl::opt<bool >
778
793
IncludeLocals (" include-locals" , llvm::cl::desc(" Index local symbols too." ),
779
794
llvm::cl::cat(Category), llvm::cl::init(false ));
@@ -4556,12 +4571,19 @@ int main(int argc, char *argv[]) {
4556
4571
}
4557
4572
InitInvok.getLangOptions ().EnableObjCAttrRequiresFoundation =
4558
4573
!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;
4565
4587
4566
4588
for (auto ConfigName : options::BuildConfigs)
4567
4589
InitInvok.getLangOptions ().addCustomConditionalCompilationFlag (ConfigName);
0 commit comments