mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Debug variable info may be attached to debug_value, debug_value_addr, alloc_box, and alloc_stack instructions. In order to write textual SIL -> SIL testcases that exercise the handling of debug information by SIL passes, we need to make a couple of additions to the textual SIL language. In memory, the debug information attached to SIL instructions references information from the AST. If we want to create debug info from parsing a textual .sil file, these bits need to be made explicit. Performance Notes: This is memory neutral for compilations from Swift source code, because the variable name is still stored in the AST. For compilations from textual source the variable name is stored in tail- allocated memory following the SIL instruction that introduces the variable. <rdar://problem/22707128>
25 lines
716 B
Swift
25 lines
716 B
Swift
// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
|
|
// RUN: %target-swift-frontend %s -emit-sil -g -o - | FileCheck -check-prefix=CHECK-SIL %s
|
|
|
|
// Verify that -Onone shadow copies are emitted for debug_value_addr
|
|
// instructions.
|
|
|
|
// CHECK-SIL: sil hidden @_TF16debug_value_addr4testurFxT_
|
|
// CHECK-SIL: debug_value_addr %0 : $*T, let, name "t"
|
|
|
|
// CHECK: define {{.*}}_TF16debug_value_addr4testurFxT_
|
|
// CHECK: entry:
|
|
// CHECK-NEXT: %[[TADDR:.*]] = alloca
|
|
// CHECK: store %swift.opaque* %0, %swift.opaque** %[[TADDR:.*]], align
|
|
// CHECK-NEXT: call void @llvm.dbg.declare({{.*}}%[[TADDR]]
|
|
|
|
struct S<T> {
|
|
var a : T
|
|
func foo() {}
|
|
}
|
|
|
|
func test<T>(t : T) {
|
|
let a = S(a: t )
|
|
a.foo()
|
|
}
|