mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Debug Info! Add basic support for line tables, compilation units, files,
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
This commit is contained in:
28
test/DebugInfo/basic.swift
Normal file
28
test/DebugInfo/basic.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user