IR: Create SymbolTableList wrapper around iplist, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 7 Oct 2015 20:05:10 +0000 (20:05 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 7 Oct 2015 20:05:10 +0000 (20:05 +0000)
commit2a8bcfaff1fda1ed06e277521d546c668bc7a0d9
treec424236b060a3b33373b260cf00b89a1b1437210
parente34457738879a6f5059d5b72b30e9bfa001bab59
IR: Create SymbolTableList wrapper around iplist, NFC

Create `SymbolTableList`, a wrapper around `iplist` for lists that
automatically manage a symbol table.  This commit reduces a ton of code
duplication between the six traits classes that were used previously.

As a drive by, reduce the number of template parameters from 2 to 1 by
using a SymbolTableListParentType metafunction (I originally had this as
a separate commit, but it touched most of the same lines so I squashed
them).

I'm in the process of trying to remove the UB in `createSentinel()` (see
the FIXMEs I added for `ilist_embedded_sentinel_traits` and
`ilist_half_embedded_sentinel_traits`).  My eventual goal is to separate
the list logic into a base class layer that knows nothing about (and
isn't templated on) the downcasted nodes -- removing the need to invoke
UB -- but for now I'm just trying to get a handle on all the current use
cases (and cleaning things up as I see them).

Besides these six SymbolTable lists, there are two others that use the
addNode/removeNode/transferNodes() hooks: the `MachineInstruction` and
`MachineBasicBlock` lists.  Ideally there'll be a way to factor these
hooks out of the low-level API entirely, but I'm not quite there yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249602 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
include/llvm/ADT/ilist.h
include/llvm/ADT/ilist_node.h
include/llvm/IR/Argument.h
include/llvm/IR/BasicBlock.h
include/llvm/IR/Function.h
include/llvm/IR/GlobalAlias.h
include/llvm/IR/GlobalVariable.h
include/llvm/IR/InstIterator.h
include/llvm/IR/Instruction.h
include/llvm/IR/Metadata.h
include/llvm/IR/Module.h
include/llvm/IR/SymbolTableListTraits.h
include/llvm/IR/ValueSymbolTable.h
lib/IR/BasicBlock.cpp
lib/IR/Function.cpp
lib/IR/Module.cpp
lib/IR/SymbolTableListTraitsImpl.h