|
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 | +// 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 | 16 |
|
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 |
| 17 | +// 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 | 18 |
|
21 | 19 | // Execution testing
|
22 | 20 | // 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
|
@@ -83,10 +81,10 @@ struct Bad {}
|
83 | 81 | func testFileID(a: Int, b: Int) {
|
84 | 82 | // CHECK: MacroUser/macro_expand.swift
|
85 | 83 | 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_" |
| 84 | + // CHECK-SIL: sil_scope [[MACRO_SCOPE:[0-9]+]] { loc "{{.*}}":1:1 parent @$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_ {{.*}} } |
| 85 | + // CHECK-SIL: sil_scope [[SRC_SCOPE:[0-9]+]] { loc "{{.*}}macro_expand.swift":[[@LINE-2]] |
| 86 | + // CHECK-SIL: sil_scope {{[0-9]+}} { loc "{{.*}}":1:1 parent [[MACRO_SCOPE]] inlined_at [[SRC_SCOPE]] } |
| 87 | + // CHECK-IR: !DISubprogram(name: "customFileID", linkageName: "$s9MacroUser10testFileID1a1bySi_SitF06customdE0fMf_" |
90 | 88 |
|
91 | 89 |
|
92 | 90 | // CHECK: Builtin result is MacroUser/macro_expand.swift
|
@@ -230,26 +228,32 @@ func testNestedDeclInExpr() {
|
230 | 228 | @freestanding(declaration, names: named(A), named(B), named(foo), named(addOne))
|
231 | 229 | macro defineDeclsWithKnownNames() = #externalMacro(module: "MacroDefinition", type: "DefineDeclsWithKnownNamesMacro")
|
232 | 230 |
|
233 |
| -//#bitwidthNumberedStructs("MyIntGlobal") |
234 |
| -// |
235 |
| -//#bitwidthNumberedStructs("MyIntGlobalTwo", blah: false) |
236 |
| -// |
237 |
| -//let blah = false |
238 |
| -//#bitwidthNumberedStructs("MyIntGlobalThree", blah: blah) |
| 231 | +// FIXME: Macros producing arbitrary names are not supported yet |
| 232 | +#if false |
| 233 | +#bitwidthNumberedStructs("MyIntGlobal") |
| 234 | + |
| 235 | +#bitwidthNumberedStructs("MyIntGlobalTwo", blah: false) |
| 236 | + |
| 237 | +let blah = false |
| 238 | +#bitwidthNumberedStructs("MyIntGlobalThree", blah: blah) |
| 239 | +#endif |
239 | 240 |
|
240 | 241 | // Test unqualified lookup from within a macro expansion
|
241 | 242 | @freestanding(declaration, names: named(StructWithUnqualifiedLookup))
|
242 | 243 | 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 | 244 |
|
247 | 245 | @freestanding(declaration)
|
248 | 246 | macro anonymousTypes(_: () -> String) = #externalMacro(module: "MacroDefinition", type: "DefineAnonymousTypesMacro")
|
249 | 247 |
|
250 |
| -#anonymousTypes { "hello" } |
251 | 248 |
|
252 |
| -// CECK-SIL: $s9MacroUser14anonymousTypesfMf0_4namefMu_ |
| 249 | +// FIXME: Global freestanding macros not yet supported in script mode. |
| 250 | +#if false |
| 251 | +let world = 3 // to be used by the macro expansion below |
| 252 | +#structWithUnqualifiedLookup() |
| 253 | +_ = StructWithUnqualifiedLookup().foo() |
| 254 | + |
| 255 | +#anonymousTypes { "hello" } |
| 256 | +#endif |
253 | 257 |
|
254 | 258 | func testFreestandingMacroExpansion() {
|
255 | 259 | // Explicit structs to force macros to be parsed as decl.
|
@@ -309,7 +313,5 @@ func testFreestandingMacroExpansion() {
|
309 | 313 | // print(MyIntGlobal64.self)
|
310 | 314 |
|
311 | 315 | #anonymousTypes { "hello" }
|
312 |
| - // expected-note @-1 2 {{in expansion of macro 'anonymousTypes' here}} |
313 |
| - // HECK-SIL: $s9MacroUser016testFreestandingA9ExpansionyyF14anonymousTypesfMf1_4namefMu_ |
314 | 316 | }
|
315 | 317 | testFreestandingMacroExpansion()
|
0 commit comments