It appears that this behaviour isn't available in Swift. I wasn't able to find any related issues on the Swift repo, or Apple's fork of LLVM.
Has this been looked into before? Is there any reason why it can't be done, or would be difficult?.
I find this feature really useful, to prevent needing to write smelly code like:
func add(_ a: Int, _ b: Int) -> Int {
// I don't actually want this useless variable,
// but I add it in just for debugging.
let result = a + b
return result
}
IIRC, this is a known issue. LLDB currently doesn't know enough about the Swift calling convention to know where to find the return value of a Swift function. Unfortunately the calling convention details in LLVM are not neatly organized into a TableGen file but rather spread out over a few thousand lines of code so fixing this is a non-trivial amount of work.