rust-lang/rust — pull request #19737 by michaelwoerister (2014-12-11 16:46:14+00:00)
Title: debuginfo: Make debuginfo source location assignment more stable (Pt. 1)

So far, the source location an LLVM instruction was linked to was controlled by `debuginfo::set_source_location()` and `debuginfo::clear_source_location()`. This interface mimicked how LLVM's `IRBuilder` handles debug location assignment. While this interface has some theoretical performance benefits, it also makes things terribly unstable: One sets some quasi-global state and then hopes that it is still correct when a given instruction is emitted---an assumption that has been proven to not hold a bit too often.

This patch requires the debug source location to be passed to the actual instruction emitting function. This makes source location assignment explicit and will prevent future changes to `trans` from accidentally breaking things in the majority of cases.

This patch does not yet implement the new principle for all instruction kinds but the stepping experience should have improved significantly nonetheless already.