mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
and lexical scopes, which can be enabled through the new -g option. When -g is enabled, line tables and scopes compile all the way down to DWARF. Changes to SIL: - In addition to a SILLocation, every instruction now also has a pointer to a SILDebugScope (its containing lexical scope). - Added LexicalScope, which is to be used for all Scopes we want to show up in the debug info. Swift SVN r5772
29 lines
1003 B
Swift
29 lines
1003 B
Swift
// A very basic test for debug info.
|
|
|
|
// Verify that we don't emit any debug info by default.
|
|
// RUN: %swift -triple x86_64-apple-darwin10 %s -emit-llvm -o - | FileCheck %s --check-prefix NDEBUG
|
|
// NDEBUG-NOT: !dbg
|
|
// NDEBUG-NOT: DW_TAG
|
|
|
|
// Now check that we do generate line+scope info with -g.
|
|
// RUN: %swift -triple x86_64-apple-darwin10 %s -emit-llvm -g -o - | FileCheck %s
|
|
|
|
func f(a: Int, b:Int) -> Int {
|
|
// CHECK-DAG: i32 [[@LINE-1]],{{.*}}DW_TAG_lexical_block
|
|
if b != 0 {
|
|
// CHECK-DAG: i32 [[@LINE-1]],{{.*}}DW_TAG_lexical_block
|
|
// CHECK-DAG: ret{{.*}}, !dbg ![[DBG:[0-9]+]]
|
|
// CHECK-DAG: [[DBG]] = metadata !{i32 [[@LINE+1]],
|
|
return a/b
|
|
} else {
|
|
// CHECK-DAG: [[PARENT:[0-9]+]] = {{.*}}i32 [[@LINE-1]],{{.*}}DW_TAG_lexical_block
|
|
var c = 42
|
|
if a == 0 {
|
|
// CHECK-DAG: metadata ![[PARENT]], i32 [[@LINE-1]],{{.*}}DW_TAG_lexical_block
|
|
// What about a nested scope?
|
|
return 0
|
|
}
|
|
return c
|
|
}
|
|
}
|