Fix the type-checker's recursive value type checking.

Track the types we've seen instead of the type declarations we've
passed through, which eliminates some holes relating to generic types.
Detect infinite expansions by imposing an arbitrary limit.

Fixes rdar://30355804
This commit is contained in:
John McCall
2017-04-12 14:47:02 -04:00
parent b50c1b0a97
commit b233e872dc
11 changed files with 696 additions and 169 deletions

View File

@@ -957,6 +957,17 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.SolverMemoryThreshold = threshold;
}
if (const Arg *A = Args.getLastArg(OPT_value_recursion_threshold)) {
unsigned threshold;
if (StringRef(A->getValue()).getAsInteger(10, threshold)) {
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
A->getAsString(Args), A->getValue());
return true;
}
Opts.MaxCircularityDepth = threshold;
}
for (const Arg *A : make_range(Args.filtered_begin(OPT_D),
Args.filtered_end())) {