forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request swiftlang#13885 from cwakamo/fix-defer-playground-…
…pcmacro-swift-4.1 [Swift 4.1] Fix the handling of defer statements in the playground transform and PC macro.
- Loading branch information
Showing
5 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// RUN: rm -rf %t | ||
// RUN: mkdir -p %t | ||
// RUN: cp %s %t/main.swift | ||
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift | ||
// RUN: %target-run %t/main | %FileCheck %s | ||
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift | ||
// RUN: %target-run %t/main | %FileCheck %s | ||
// REQUIRES: executable_test | ||
|
||
// FIXME: rdar:https://problem/30234450 PCMacro tests fail on linux in optimized mode | ||
// UNSUPPORTED: OS=linux-gnu | ||
|
||
#sourceLocation(file: "main.swift", line: 8) | ||
func foo() { | ||
defer { | ||
2 | ||
} | ||
1 | ||
} | ||
|
||
foo() | ||
|
||
// CHECK: [15:1-15:6] pc before | ||
// CHECK-NEXT: [8:1-8:11] pc before | ||
// CHECK-NEXT: [8:1-8:11] pc after | ||
// CHECK-NEXT: [12:3-12:4] pc before | ||
// CHECK-NEXT: [12:3-12:4] pc after | ||
// CHECK-NEXT: [10:5-10:6] pc before | ||
// CHECK-NEXT: [10:5-10:6] pc after | ||
// CHECK-NEXT: [15:1-15:6] pc after |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// RUN: rm -rf %t | ||
// RUN: mkdir -p %t | ||
// RUN: cp %s %t/main.swift | ||
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift | ||
// RUN: %target-run %t/main | %FileCheck %s | ||
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift | ||
// RUN: %target-run %t/main | %FileCheck %s | ||
// REQUIRES: executable_test | ||
|
||
// FIXME: rdar:https://problem/30234450 PCMacro tests fail on linux in optimized mode | ||
// UNSUPPORTED: OS=linux-gnu | ||
|
||
#sourceLocation(file: "main.swift", line: 8) | ||
func foo() { | ||
func bar() { | ||
2 | ||
} | ||
|
||
let baz: () -> Void = { | ||
3 | ||
} | ||
|
||
1 | ||
bar() | ||
baz() | ||
} | ||
|
||
foo() | ||
|
||
// CHECK: [22:1-22:6] pc before | ||
// CHECK-NEXT: [8:1-8:11] pc before | ||
// CHECK-NEXT: [8:1-8:11] pc after | ||
// CHECK-NEXT: [13:3-15:4] pc before | ||
// CHECK-NEXT: [13:3-15:4] pc after | ||
// CHECK-NEXT: [17:3-17:4] pc before | ||
// CHECK-NEXT: [17:3-17:4] pc after | ||
// CHECK-NEXT: [18:3-18:8] pc before | ||
// CHECK-NEXT: [9:3-9:13] pc before | ||
// CHECK-NEXT: [9:3-9:13] pc after | ||
// CHECK-NEXT: [10:5-10:6] pc before | ||
// CHECK-NEXT: [10:5-10:6] pc after | ||
// CHECK-NEXT: [18:3-18:8] pc after | ||
// CHECK-NEXT: [19:3-19:8] pc before | ||
// CHECK-NEXT: [14:5-14:6] pc before | ||
// CHECK-NEXT: [14:5-14:6] pc after | ||
// CHECK-NEXT: [14:5-14:6] pc before | ||
// CHECK-NEXT: [14:5-14:6] pc after | ||
// CHECK-NEXT: [19:3-19:8] pc after | ||
// CHECK-NEXT: [22:1-22:6] pc after |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: %empty-directory(%t) | ||
// RUN: cp %s %t/main.swift | ||
// RUN: %target-build-swift -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %t/main.swift | ||
// RUN: %target-run %t/main | %FileCheck %s | ||
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PlaygroundsRuntime.swift %S/Inputs/SilentPCMacroRuntime.swift %t/main.swift | ||
// RUN: %target-run %t/main | %FileCheck %s | ||
// REQUIRES: executable_test | ||
func foo() { | ||
defer { | ||
2 | ||
} | ||
1 | ||
} | ||
foo() | ||
// CHECK: {{.*}} $builtin_log_scope_entry | ||
// CHECK-NEXT: {{.*}} $builtin_log[='1'] | ||
// CHECK-NEXT: {{.*}} $builtin_log_scope_exit | ||
// CHECK-NEXT: {{.*}} $builtin_log_scope_entry | ||
// CHECK-NEXT: {{.*}} $builtin_log[='2'] | ||
// CHECK-NEXT: {{.*}} $builtin_log_scope_exit |