Merge pull request #82321 from slavapestov/rqm-fixes

RequirementMachine: Add more limits to catch runaway computation, and fix a bug
This commit is contained in:
Slava Pestov
2025-06-18 23:00:38 -04:00
committed by GitHub
20 changed files with 198 additions and 38 deletions

View File

@@ -1769,6 +1769,28 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}
if (const Arg *A = Args.getLastArg(OPT_requirement_machine_max_concrete_size)) {
unsigned limit;
if (StringRef(A->getValue()).getAsInteger(10, limit)) {
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
A->getAsString(Args), A->getValue());
HadError = true;
} else {
Opts.RequirementMachineMaxConcreteSize = limit;
}
}
if (const Arg *A = Args.getLastArg(OPT_requirement_machine_max_type_differences)) {
unsigned limit;
if (StringRef(A->getValue()).getAsInteger(10, limit)) {
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
A->getAsString(Args), A->getValue());
HadError = true;
} else {
Opts.RequirementMachineMaxTypeDifferences = limit;
}
}
if (const Arg *A = Args.getLastArg(OPT_requirement_machine_max_split_concrete_equiv_class_attempts)) {
unsigned limit;
if (StringRef(A->getValue()).getAsInteger(10, limit)) {