|
4 | 4 | // RUN: split-file %s %t |
5 | 5 | // RUN: %host-build-swift -swift-version 5 -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %t/macro.swift |
6 | 6 |
|
7 | | -// RUN: %target-swift-frontend -typecheck -module-load-mode prefer-serialized -module-name MyApp -module-cache-path %t/clang-module-cache -O \ |
8 | | -// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ |
9 | | -// RUN: %t/main.swift -swift-version 5 -external-plugin-path %t#%swift-plugin-server 2> %t/diag1.txt |
10 | | - |
11 | 7 | // RUN: %target-swift-frontend -scan-dependencies -module-load-mode prefer-serialized -module-name MyApp -module-cache-path %t/clang-module-cache -O \ |
12 | 8 | // RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ |
13 | 9 | // RUN: %t/main.swift -o %t/deps.json -swift-version 5 -cache-compile-job -cas-path %t/cas -external-plugin-path %t#%swift-plugin-server |
|
24 | 20 | // RUN: -swift-version 5 -module-name MyApp -O \ |
25 | 21 | // RUN: -external-plugin-path %t#%swift-plugin-server \ |
26 | 22 | // RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ |
27 | | -// RUN: %t/main.swift @%t/MyApp.cmd -serialize-diagnostics-path %t/Test.diag 2> %t/diag2.txt |
| 23 | +// RUN: %t/main.swift @%t/MyApp.cmd -serialize-diagnostics-path %t/Test.diag 2>&1 | %FileCheck -check-prefix CHECK-DIAG %s |
| 24 | + |
| 25 | +// CHECK-DIAG: macro expansion #myWarning:1:1: warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration] |
| 26 | +// CHECK-DIAG-NEXT: `- TMP_DIR{{/|\\}}main.swift:8:36: note: expanded code originates here |
| 27 | +// CHECK-DIAG-NEXT: 6 | |
| 28 | +// CHECK-DIAG-NEXT: 7 | func testDiscardableStringify(x: Int) { |
| 29 | +// CHECK-DIAG-NEXT: 8 | #toMyWarning("this is a warning") |
| 30 | +// CHECK-DIAG-NEXT: | `- note: in expansion of macro 'toMyWarning' here |
| 31 | +// CHECK-DIAG-NEXT: +--- macro expansion #toMyWarning ----------------------------------- |
| 32 | +// CHECK-DIAG-NEXT: |1 | #myWarning("") |
| 33 | +// CHECK-DIAG-NEXT: | | `- note: in expansion of macro 'myWarning' here |
| 34 | +// CHECK-DIAG-NEXT: | +--- macro expansion #myWarning ---------------------------------- |
| 35 | +// CHECK-DIAG-NEXT: | |1 | testDeprecated() |
| 36 | +// CHECK-DIAG-NEXT: | | | `- warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration] |
| 37 | +// CHECK-DIAG-NEXT: | +----------------------------------------------------------------- |
| 38 | +// CHECK-DIAG-NEXT: +-------------------------------------------------------------------- |
| 39 | +// CHECK-DIAG-NEXT: 9 | #myWarning("this is a warning") |
| 40 | +// CHECK-DIAG-NEXT: 10 | } |
28 | 41 |
|
29 | | -// RUN: diff %t/diag1.txt %t/diag2.txt |
| 42 | +// CHECK-DIAG: macro expansion #myWarning:1:1: warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration] |
| 43 | +// CHECK-DIAG-NEXT: `- TMP_DIR{{/|\\}}main.swift:9:34: note: expanded code originates here |
| 44 | +// CHECK-DIAG-NEXT: 7 | func testDiscardableStringify(x: Int) { |
| 45 | +// CHECK-DIAG-NEXT: 8 | #toMyWarning("this is a warning") |
| 46 | +// CHECK-DIAG-NEXT: 9 | #myWarning("this is a warning") |
| 47 | +// CHECK-DIAG-NEXT: | `- note: in expansion of macro 'myWarning' here |
| 48 | +// CHECK-DIAG-NEXT: +--- macro expansion #myWarning ------------------------------------- |
| 49 | +// CHECK-DIAG-NEXT: |1 | testDeprecated() |
| 50 | +// CHECK-DIAG-NEXT: | | `- warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration] |
| 51 | +// CHECK-DIAG-NEXT: +-------------------------------------------------------------------- |
| 52 | +// CHECK-DIAG-NEXT: 10 | } |
| 53 | +// CHECK-DIAG-NEXT: 11 | |
| 54 | +// CHECK-DIAG: [#DeprecatedDeclaration]: <https://docs.swift.org/compiler/documentation/diagnostics/deprecated-declaration> |
30 | 55 |
|
31 | 56 | //--- macro.swift |
32 | 57 | import SwiftDiagnostics |
|
0 commit comments