mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add -warn-long-expression-type-checking=<limit> frontend option.
Generates a warning for any expression that takes longer than <limit> milliseconds to type check. This compliments the existing -warn-long-function-body=<limit> option.
This commit is contained in:
@@ -216,6 +216,16 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
||||
}
|
||||
}
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_warn_long_expression_type_checking)) {
|
||||
unsigned attempt;
|
||||
if (StringRef(A->getValue()).getAsInteger(10, attempt)) {
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getAsString(Args), A->getValue());
|
||||
} else {
|
||||
Opts.WarnLongExpressionTypeChecking = attempt;
|
||||
}
|
||||
}
|
||||
|
||||
Opts.PlaygroundTransform |= Args.hasArg(OPT_playground);
|
||||
if (Args.hasArg(OPT_disable_playground_transform))
|
||||
Opts.PlaygroundTransform = false;
|
||||
|
||||
Reference in New Issue
Block a user