Files
swift-mirror/test/DebugInfo/callexpr.swift
Adrian Prantl b998c103fc Debug Info: Associate a function call with the beginning of the expression.
Before this change, stepping through the code
  1 foo(x,
  2     f(a)
  3     f(b)
  4   )

would visit the code in the order 2, 3, 4, with the function call
being on line 4.  After this patch the order is 2, 3, 1 with the
function call being on line 1. This is both closer to what clang
generates for simialar C code and more useful to the programmer since
it is easier to understand which function is being called in a nested
expression.

rdar://problem/35430708
2017-11-10 14:37:47 -08:00

18 lines
564 B
Swift

// RUN: %target-swift-frontend %s -g -emit-ir -o - | %FileCheck %s
func markUsed<T>(_ t: T) {}
func foo(_ a : Int64, _ b : Int64) -> Int64 {
return a+b
}
// CHECK: call {{.*}}foo{{.*}}, !dbg ![[ARG1:.*]]
// CHECK: call {{.*}}foo{{.*}}, !dbg ![[ARG2:.*]]
// CHECK: call {{.*}}foo{{.*}}, !dbg ![[OUTER:.*]]
let r = foo(
foo(1, 23), // CHECK: ![[ARG1]] = !DILocation(line: [[@LINE]],
foo(2, 42) // CHECK: ![[ARG2]] = !DILocation(line: [[@LINE]],
) // CHECK: ![[OUTER]] = !DILocation(line: [[@LINE-3]],
markUsed(r)