Skip to content

Commit 6a3ca6d

Browse files
committed
[Performance Hints] Disable performance hints if typechecker skips some function bodies
If `SkipFunctionBodies` is not `None`, functions that are inlinable or not used for the result are not typechecked. The absence of type information crashes the performance hint analyzer. This change prevents the analyzer from running in these cases.
1 parent c978386 commit 6a3ca6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Sema/PerformanceHints.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
using namespace swift;
3232

3333
bool swift::performanceHintDiagnosticsEnabled(ASTContext &ctx) {
34-
return !ctx.Diags.isIgnoredDiagnosticGroupTree(DiagGroupID::PerformanceHints);
34+
return !ctx.Diags.isIgnoredDiagnosticGroupTree(DiagGroupID::PerformanceHints) &&
35+
(ctx.TypeCheckerOpts.SkipFunctionBodies == FunctionBodySkipping::None);
3536
}
3637

3738
namespace {

0 commit comments

Comments
 (0)