Please sign in to comment.
Add frontend option "-warn-long-function-bodies=<N>".
This is a /slightly/ more user-friendly option than -debug-time-function-bodies; pass it a limit in milliseconds and the compiler will warn whenever a function or multi-statement closure takes longer than that to type-check. Since it's a frontend option (and thus usually passed with -Xfrontend), I went with the "joined" syntax as the common case. The usual "separate" syntax of "-warn-long-function-bodies <N>" is also available. As a frontend option, this is UNSUPPORTED and may be removed without notice at any future date. Additional caveats: - Other parts of type-checking not measured by this may also be slow. - May include first-use penalties (i.e. "this is slow because it's the first function that references an imported type, which causes many things to be imported") - Does not report anything whatsoever about other phases of compilation (SILGen, optimization, IRGen, assembly emission, whatever). - Does not catch anything accidentally being type-checked multiple times (a known issue for initial value expressions on properties).
- Loading branch information
Showing with 107 additions and 25 deletions.
- +11 −0 include/swift/AST/DiagnosticsSema.def
- +6 −0 include/swift/Frontend/FrontendOptions.h
- +6 −0 include/swift/Option/FrontendOptions.td
- +6 −2 include/swift/Subsystems.h
- +10 −0 lib/Frontend/CompilerInvocation.cpp
- +6 −4 lib/Frontend/Frontend.cpp
- +45 −18 lib/Sema/TypeCheckStmt.cpp
- +3 −1 lib/Sema/TypeChecker.cpp
- +14 −0 lib/Sema/TypeChecker.h