File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
lib/SILOptimizer/Mandatory
test/SourceKit/Diagnostics Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -805,6 +805,10 @@ class PerformanceDiagnosticsPass : public SILModuleTransform {
805805 void run () override {
806806 SILModule *module = getModule ();
807807
808+ // Skip all performance/embedded diagnostics if not in WMO mode. Building in
809+ // non-WMO mode currently results in false positives.
810+ if (!module ->isWholeModule ()) return ;
811+
808812 PerformanceDiagnostics diagnoser (*module , getAnalysis<BasicCalleeAnalysis>());
809813
810814 // Check that @_section, @_silgen_name is only on constant globals
Original file line number Diff line number Diff line change 1+ // Check that when emitting diagnostics in SourceKit, we don't report false positives in PerformanceDiagnostics (because WMO is disabled).
2+
3+ // RUN: %empty-directory(%t)
4+ // RUN: split-file %s %t
5+
6+ // RUN: %sourcekitd-test -req=diags %t/file1.swift -- %t/file1.swift %t/file2.swift -enable-experimental-feature Embedded | %FileCheck %s
7+
8+ // REQUIRES: swift_in_compiler
9+ // REQUIRES: embedded_stdlib
10+ // REQUIRES: OS=macosx || OS=linux-gnu
11+
12+ //--- file1.swift
13+
14+ func foo( ) {
15+ bar ( Int . self)
16+ }
17+
18+ @main
19+ struct Main {
20+ static func main( ) {
21+ foo ( )
22+ }
23+ }
24+
25+ //--- file2.swift
26+
27+ func bar< T> ( _ T: T . Type ) {
28+
29+ }
30+
31+ // CHECK: {
32+ // CHECK-NEXT: key.diagnostics: [
33+ // CHECK-NEXT: ]
34+ // CHECK-NEXT: }
You can’t perform that action at this time.
0 commit comments