In a recent thread on LLVM-dev "Stripping Debug Locations on cross BB moves, part 2 (PR31891)" we discovered that the existing API for
getMergedLocation() is unsafe when used on CallInstructions. This patch moves the API from DILocation on Instruction so it automatically behaves correctly (i.e. return a line-0 debug loc) when used on a call instruction.
Once we agree on the exact API, I will split the patch up into an NFC commit that just moves the API and is a NOP on CallInstructions, and a second one that returns the line-0 location for CallInstructions.
I'm not sure we can get the scope right, though - since we're potentially moving this location across scopes. It's going to be jumpy/create a difficult range in the scope no matter what, really...
Any ideas? Take the scope from a nearby location at the destination, if possible? (doesn't really reflect reality, but nothing will - this would at least mean a chance of not punching holes in/making islands in scopes that would necessitate a DW_AT_ranges/more verbose description/etc)