ADT: Split ilist_node_traits into alloc and callback, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 30 Aug 2016 18:40:47 +0000 (18:40 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 30 Aug 2016 18:40:47 +0000 (18:40 +0000)
commitf947c3afe10cf4a8ca3574ddd4deee2032254c53
treeb84e7e98ea1822fdbbbd62346ad43cf00e4bca3c
parent982a3bcc4896d3edb7c66d69095335eddcae5c18
ADT: Split ilist_node_traits into alloc and callback, NFC

Many lists want to override only allocation semantics, or callbacks for
iplist.  Split these up to prevent code duplication.
- Specialize ilist_alloc_traits to change the implementations of
  deleteNode() and createNode().
- One common desire is to do nothing deleteNode() and disable
  createNode().  Specialize ilist_alloc_traits to inherit from
  ilist_noalloc_traits for that behaviour.
- Specialize ilist_callback_traits to use the addNodeToList(),
  removeNodeFromList(), and transferNodesFromList() callbacks.

As a drive-by, add some coverage to the callback-related unit tests.

llvm-svn: 280128
16 files changed:
llvm/include/llvm/ADT/ilist.h
llvm/include/llvm/CodeGen/MachineBasicBlock.h
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/include/llvm/CodeGen/MachineInstr.h
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/include/llvm/CodeGen/SlotIndexes.h
llvm/include/llvm/IR/Metadata.h
llvm/include/llvm/IR/Module.h
llvm/include/llvm/IR/SymbolTableListTraits.h
llvm/include/llvm/MC/MCSection.h
llvm/lib/CodeGen/MachineBasicBlock.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/MC/MCFragment.cpp
llvm/lib/Support/YAMLParser.cpp
llvm/unittests/ADT/IListTest.cpp