mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This achieves the same as clang's `-fdebug-info-for-profiling`, which emits DWARF discriminators to aid in narrowing-down which basic block corresponds to a particular instruction address. This is particularly useful for sampling-based profiling. rdar://135443278
17 lines
404 B
Swift
17 lines
404 B
Swift
// RUN: %target-swift-frontend %s -emit-ir -g -debug-info-for-profiling -o - | %FileCheck %s
|
|
|
|
// CHECK: distinct !DICompileUnit(language: DW_LANG_Swift
|
|
// CHECK-SAME: debugInfoForProfiling: true
|
|
|
|
// CHECK: !DILexicalBlockFile({{.*}} discriminator: 2)
|
|
|
|
public func lobster(_ n: Int) -> Bool {
|
|
guard n > 0 else { fatalError("too cold!") }
|
|
|
|
if n > 100 {
|
|
print("warm but ok")
|
|
}
|
|
|
|
return n < 120
|
|
}
|