[Coverage] Make ~ProfilerRAII restore the correct context

Swift permits function decls within function decls. ~ProfilerRAII would
destroy the current profiling context upon entering a nested function
decl instead of preserving it for later use. Fix the issue by recording
the correct context in ProfilerRAII.
This commit is contained in:
Vedant Kumar
2016-02-12 21:12:33 -08:00
parent 7b34ea9296
commit c5873f3683
3 changed files with 27 additions and 11 deletions

View File

@@ -53,4 +53,15 @@ func main() {
let _ = Class1()
}
// rdar://problem/22761498 - enum declaration suppresses coverage
func foo() {
var x : Int32 = 0 // CHECK-COV: 1|{{.*}}[[@LINE]]
enum ETy { case A } // CHECK-COV: 1|{{.*}}[[@LINE]]
repeat { // CHECK-COV: 1|{{.*}}[[@LINE]]
x += 1 // CHECK-COV: 1|{{.*}}[[@LINE]]
} while x == 0 // CHECK-COV: 1|{{.*}}[[@LINE]]
x += 1 // CHECK-COV: 1|{{.*}}[[@LINE]]
}
main()
foo()