Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
is this to use with Instruction::eraseFromParent? if so I think that change should also be in this patch to show why this patch exists
It is exactly the same. There is no super strong reason for having both functions.
The main reason is that the BB behaves like a list as it implements begin(), end(), size(), splice() etc. so not having an erase(I) function looks strange.
Up until now one could simply do BB->getInstList().erase(I), instead of I->eraseFromParent(), so this function is covering this case.
I->eraseFromParent() now calls BasicBlock::erase(BB). Also BasicBlock::erase(BB) now calls InstList.erase() directly instead of calling BasicBlock::erase(FromIt, ToIt).
If the intention is to make it behave like a container, then the erase method should take an iterator.
But who would possibly use it if it requires a BB reference to call the method? It is kind of easier and safer to just I->eraseFromParent().
I don't mind adding this, just don't see how it can be useful.
If the intention is to make it behave like a container, then the erase method should take an iterator.
But who would possibly use it if it requires a BB reference to call the method? It is kind of easier and safer to just I->eraseFromParent().
I don't mind adding this, just don't see how it can be useful.
I agree, I think it is not very useful. I will abandon the patch.