RequirementMachine: Add concrete nesting depth check

Configured with -requirement-machine-max-concrete-nesting= frontend flag.
This commit is contained in:
Slava Pestov
2022-02-03 21:46:20 -05:00
parent 634ca55764
commit 0060592b85
9 changed files with 87 additions and 1 deletions

View File

@@ -950,6 +950,17 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}
if (const Arg *A = Args.getLastArg(OPT_requirement_machine_max_concrete_nesting)) {
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.RequirementMachineMaxConcreteNesting = limit;
}
}
return HadError || UnsupportedOS || UnsupportedArch;
}