|
1 |
| -// UN: %empty-directory(%t) |
2 |
| -// UN: %target-build-swift -swift-version 5 -I %swift-host-lib-dir -L %swift-host-lib-dir -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath -swift-version 5 |
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-build-swift -swift-version 5 -I %swift-host-lib-dir -L %swift-host-lib-dir -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %S/Inputs/syntax_macro_definitions.swift -g -no-toolchain-stdlib-rpath -swift-version 5 |
3 | 3 | // RUNx: %target-swift-frontend -dump-ast -enable-experimental-feature FreestandingMacros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir %s -module-name MacroUser 2>&1 | %FileCheck --check-prefix CHECK-AST %s
|
4 | 4 |
|
5 | 5 | // Diagnostics testing
|
|
12 | 12 |
|
13 | 13 | // RUN: %FileCheck %s --check-prefix CHECK-MACRO-PRINTED < %t/macro-printing.txt
|
14 | 14 |
|
15 |
| -// FIXME(rdar://106053984) Debug info SIL testing (re-enable -g) |
16 |
| -// UN: %target-swift-frontend -swift-version 5 -emit-sil -enable-experimental-feature FreestandingMacros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir %s -module-name MacroUser -o - | %FileCheck --check-prefix CHECK-SIL %s |
| 15 | +// Debug info SIL testing |
| 16 | +// RUN: %target-swift-frontend -swift-version 5 -emit-sil -enable-experimental-feature FreestandingMacros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir %s -module-name MacroUser -o - -g | %FileCheck --check-prefix CHECK-SIL %s |
17 | 17 |
|
18 |
| -// FIXME(rdar://106053984) Debug info IR testing (re-enable -g) |
19 |
| -// UN: %target-swift-frontend -swift-version 5 -emit-ir -enable-experimental-feature FreestandingMacros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir %s -module-name MacroUser -o - | %FileCheck --check-prefix CHECK-IR %s |
| 18 | +// Debug info IR testing |
| 19 | +// RUN: %target-swift-frontend -swift-version 5 -emit-ir -enable-experimental-feature FreestandingMacros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir %s -module-name MacroUser -o - -g | %FileCheck --check-prefix CHECK-IR %s |
20 | 20 |
|
21 | 21 | // Execution testing
|
22 |
| -// RUN: %target-build-swift -swift-version 5 -enable-experimental-feature FreestandingMacros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir -L %swift-host-lib-dir %s -o %t/main -module-name MacroUser |
| 22 | +// RUN: %target-build-swift -swift-version 5 -g -enable-experimental-feature FreestandingMacros -load-plugin-library %t/%target-library-name(MacroDefinition) -I %swift-host-lib-dir -L %swift-host-lib-dir %s -o %t/main -module-name MacroUser |
23 | 23 | // RUN: %target-run %t/main | %FileCheck %s
|
24 | 24 | // REQUIRES: executable_test
|
25 | 25 |
|
@@ -83,10 +83,10 @@ struct Bad {}
|
83 | 83 | func testFileID(a: Int, b: Int) {
|
84 | 84 | // CHECK: MacroUser/macro_expand.swift
|
85 | 85 | print("Result is \(#customFileID)")
|
86 |
| - // HECK-SIL: sil_scope [[MACRO_SCOPE:[0-9]+]] { loc "{{.*}}":1:1 parent @$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_ {{.*}} } |
87 |
| - // HECK-SIL: sil_scope [[SRC_SCOPE:[0-9]+]] { loc "{{.*}}macro_expand.swift":[[@LINE-2]] |
88 |
| - // HECK-SIL: sil_scope {{[0-9]+}} { loc "{{.*}}":1:1 parent [[MACRO_SCOPE]] inlined_at [[SRC_SCOPE]] } |
89 |
| - // HECK-IR: !DISubprogram(name: "customFileID", linkageName: "$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_" |
| 86 | + // CHECK-SIL: sil_scope [[MACRO_SCOPE:[0-9]+]] { loc "{{.*}}":1:1 parent @$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_ {{.*}} } |
| 87 | + // CHECK-SIL: sil_scope [[SRC_SCOPE:[0-9]+]] { loc "{{.*}}macro_expand.swift":[[@LINE-2]] |
| 88 | + // CHECK-SIL: sil_scope {{[0-9]+}} { loc "{{.*}}":1:1 parent [[MACRO_SCOPE]] inlined_at [[SRC_SCOPE]] } |
| 89 | + // CHECK-IR: !DISubprogram(name: "customFileID", linkageName: "$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_" |
90 | 90 |
|
91 | 91 |
|
92 | 92 | // CHECK: Builtin result is MacroUser/macro_expand.swift
|
@@ -230,26 +230,32 @@ func testNestedDeclInExpr() {
|
230 | 230 | @freestanding(declaration, names: named(A), named(B), named(foo), named(addOne))
|
231 | 231 | macro defineDeclsWithKnownNames() = #externalMacro(module: "MacroDefinition", type: "DefineDeclsWithKnownNamesMacro")
|
232 | 232 |
|
233 |
| -//#bitwidthNumberedStructs("MyIntGlobal") |
234 |
| -// |
235 |
| -//#bitwidthNumberedStructs("MyIntGlobalTwo", blah: false) |
236 |
| -// |
237 |
| -//let blah = false |
238 |
| -//#bitwidthNumberedStructs("MyIntGlobalThree", blah: blah) |
| 233 | +// FIXME: Macros producing arbitrary names are not supported yet |
| 234 | +#if false |
| 235 | +#bitwidthNumberedStructs("MyIntGlobal") |
| 236 | + |
| 237 | +#bitwidthNumberedStructs("MyIntGlobalTwo", blah: false) |
| 238 | + |
| 239 | +let blah = false |
| 240 | +#bitwidthNumberedStructs("MyIntGlobalThree", blah: blah) |
| 241 | +#endif |
239 | 242 |
|
240 | 243 | // Test unqualified lookup from within a macro expansion
|
241 | 244 | @freestanding(declaration, names: named(StructWithUnqualifiedLookup))
|
242 | 245 | macro structWithUnqualifiedLookup() = #externalMacro(module: "MacroDefinition", type: "DefineStructWithUnqualifiedLookupMacro")
|
243 |
| -let world = 3 // to be used by the macro expansion below |
244 |
| -#structWithUnqualifiedLookup() |
245 |
| -_ = StructWithUnqualifiedLookup().foo() |
246 | 246 |
|
247 | 247 | @freestanding(declaration)
|
248 | 248 | macro anonymousTypes(_: () -> String) = #externalMacro(module: "MacroDefinition", type: "DefineAnonymousTypesMacro")
|
249 | 249 |
|
250 |
| -#anonymousTypes { "hello" } |
251 | 250 |
|
252 |
| -// CECK-SIL: $s9MacroUser14anonymousTypesfMf0_4namefMu_ |
| 251 | +// FIXME: Global freestanding macros not yet supported in script mode. |
| 252 | +#if false |
| 253 | +let world = 3 // to be used by the macro expansion below |
| 254 | +#structWithUnqualifiedLookup() |
| 255 | +_ = StructWithUnqualifiedLookup().foo() |
| 256 | + |
| 257 | +#anonymousTypes { "hello" } |
| 258 | +#endif |
253 | 259 |
|
254 | 260 | func testFreestandingMacroExpansion() {
|
255 | 261 | // Explicit structs to force macros to be parsed as decl.
|
@@ -309,7 +315,5 @@ func testFreestandingMacroExpansion() {
|
309 | 315 | // print(MyIntGlobal64.self)
|
310 | 316 |
|
311 | 317 | #anonymousTypes { "hello" }
|
312 |
| - // expected-note @-1 2 {{in expansion of macro 'anonymousTypes' here}} |
313 |
| - // HECK-SIL: $s9MacroUser016testFreestandingA9ExpansionyyF14anonymousTypesfMf1_4namefMu_ |
314 | 318 | }
|
315 | 319 | testFreestandingMacroExpansion()
|
0 commit comments