IR: Remove implicit iterator conversions from lib/IR, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 8 Oct 2015 23:49:46 +0000 (23:49 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 8 Oct 2015 23:49:46 +0000 (23:49 +0000)
commiteac309550f259b7f78f1e69ea8e62fea493efd43
tree04e659bb3db41c097dff9e2fc0fb210febf75d95
parent9d523d999ecccef04c7f0faff9871a3f2d0d2c5a
IR: Remove implicit iterator conversions from lib/IR, NFC

Stop converting implicitly between iterators and pointers/references in
lib/IR.  For convenience, I've added a `getIterator()` accessor to
`ilist_node` so that callers don't need to know how to spell the
iterator class (i.e., they can use `X.getIterator()` instead of
`Function::iterator(X)`).

I'll eventually disallow these implicit conversions entirely, but
there's a lot of code, so it doesn't make sense to do it all in one
patch.  One library or so at a time.

Why?  To root out cases of `getNextNode()` and `getPrevNode()` being
used in iterator logic.  The design of `ilist` makes that invalid when
the current node could be at the back of the list, but it happens to
"work" right now because of a bug where those functions never return
`nullptr` if you're using a half-node sentinel.  Before I can fix the
function, I have to remove uses of it that rely on it misbehaving.
(Maybe the function should just be deleted anyway?  But I don't want
deleting it -- potentially a huge project -- to block fixing
ilist/iplist.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249782 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
include/llvm/ADT/ilist.h
include/llvm/ADT/ilist_node.h
include/llvm/IR/IRBuilder.h
include/llvm/Support/GenericDomTree.h
lib/IR/AsmWriter.cpp
lib/IR/AutoUpgrade.cpp
lib/IR/BasicBlock.cpp
lib/IR/Core.cpp
lib/IR/DebugInfo.cpp
lib/IR/Function.cpp
lib/IR/Globals.cpp
lib/IR/Instruction.cpp
lib/IR/Module.cpp
lib/IR/SymbolTableListTraitsImpl.h
lib/IR/TypeFinder.cpp
lib/IR/Verifier.cpp