Commits
Chris Lattner committed f8570072cd1
Teach SILGen to generate debug_value and debug_value_addr for 'let' decls.
Right now I unconditionally generate these, because silgen doesn't have
easy access to whether "-g" is passed or not. We can either make SILGen
know about this, or we can have optimizations strip these uses out.
Opinions welcome!
As an example, something like:
protocol P { func bonk() }
func foo(let a : Int, let b : P) -> Int {
let x = a
b.bonk()
return x
}
compiles into:
sil @_TF1t3fooFT1aSi1bPS_1P__Si : $@thin (Int64, @in P) -> Int64 {
bb0(%0 : $Int64, %1 : $*P):
debug_value %0 : $Int64 // let a // id: %2
debug_value_addr %1 : $*P // let b // id: %3
debug_value %0 : $Int64 // let x // id: %4
%5 = project_existential %1 : $*P to $*@sil_self P // user: %7
%6 = protocol_method %1 : $*P, #P.bonk!1 : $@cc(witness_method) @callee_owned (@inout Self) -> () // user: %7
%7 = apply %6(%5) : $@cc(witness_method) @callee_owned (@inout Self) -> ()
destroy_addr %1 : $*P // id: %8
return %0 : $Int64 // id: %9
}
Swift SVN r12193