diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-30 18:40:47 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-30 18:40:47 +0000 |
| commit | f947c3afe10cf4a8ca3574ddd4deee2032254c53 (patch) | |
| tree | b84e7e98ea1822fdbbbd62346ad43cf00e4bca3c /llvm/lib/Support | |
| parent | 982a3bcc4896d3edb7c66d69095335eddcae5c18 (diff) | |
| download | bcm5719-llvm-f947c3afe10cf4a8ca3574ddd4deee2032254c53.tar.gz bcm5719-llvm-f947c3afe10cf4a8ca3574ddd4deee2032254c53.zip | |
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
Diffstat (limited to 'llvm/lib/Support')
| -rw-r--r-- | llvm/lib/Support/YAMLParser.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp index 7490f1a9708..c083e1f1ebd 100644 --- a/llvm/lib/Support/YAMLParser.cpp +++ b/llvm/lib/Support/YAMLParser.cpp @@ -149,22 +149,15 @@ struct Token : ilist_node<Token> { } namespace llvm { -template<> -struct ilist_node_traits<Token> { +template <> struct ilist_alloc_traits<Token> { Token *createNode(const Token &V) { return new (Alloc.Allocate<Token>()) Token(V); } static void deleteNode(Token *V) { V->~Token(); } - void addNodeToList(Token *) {} - void removeNodeFromList(Token *) {} - void transferNodesFromList(ilist_node_traits & /*SrcTraits*/, - ilist_iterator<Token> /*first*/, - ilist_iterator<Token> /*last*/) {} - BumpPtrAllocator Alloc; }; -} +} // end namespace llvm typedef ilist<Token> TokenQueueT; |

