diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-21 19:52:15 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-21 19:52:15 +0000 |
commit | a848c47130b9cd328958f02a3e01e66334b60bf3 (patch) | |
tree | d52638375d8d23ddfe4e50ee9e8de8a5c2e4b792 /llvm/lib/IR | |
parent | 4ab89ea1871113d7db98e35053b3b02ccc936310 (diff) | |
download | bcm5719-llvm-a848c47130b9cd328958f02a3e01e66334b60bf3.tar.gz bcm5719-llvm-a848c47130b9cd328958f02a3e01e66334b60bf3.zip |
ADT: Stop using getNodePtrUnchecked on end() iterators
Stop using `getNodePtrUnchecked()` when building IR. Eventually a
dereference will be required to get at the downcast node, since the
iterator will only store an `ilist_node_base` of some sort.
This should have no functionality change for now, but is a path towards
removing some more UB from ilist.
llvm-svn: 261495
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/BasicBlock.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index f61276fd436..89a1d744441 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -361,10 +361,8 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName) { assert(I != InstList.end() && "Trying to get me to create degenerate basic block!"); - BasicBlock *InsertBefore = std::next(Function::iterator(this)) - .getNodePtrUnchecked(); - BasicBlock *New = BasicBlock::Create(getContext(), BBName, - getParent(), InsertBefore); + BasicBlock *New = BasicBlock::Create(getContext(), BBName, getParent(), + this->getNextNode()); // Save DebugLoc of split point before invalidating iterator. DebugLoc Loc = I->getDebugLoc(); |