The APIs for setting the insertion point of an IRBuilder behave
inconsistently w.r.t updating the current debug location. The overloads
of SetInsertPoint() may or may not change the current debug location,
and may or may not select a correct location, depending on the selected
overload and the current state of the IRBuilder.
This is inconvenient and causes correctness problems. For more
background on this issue, see the thread:
[llvm-dev] [RFC] Setting the current debug loc when the insertion point changes
This patch deprecates the following APIs:
SetInsertPoint(BasicBlock *) SetInsertPoint(Instruction *) SetInsertPoint(BasicBlock *, BasicBlock::iterator)
They are superseded by the following APIs:
setInsertPoint(BasicBlock *, const DebugLoc &) setInsertPoint(Instruction *, const DebugLoc &) setInsertPoint(BasicBlock *, BasicBlock::iterator, const DebugLoc &) getUnknownDebugLocation(BasicBlock *, BasicBlock::iterator) getUnknownDebugLocation(Instruction *)
The new APIs offer consistent handling of debug locations by requiring
clients to be more explicit. Uses of the old APIs should be audited and
phased out. New C APIs are available.
I really dislike the "2" moniker on APIs. Seems that if we want a new API that has a new behavior we should do that instead with new and descriptive names.
LLVMPositionBuilderWithLoc?