ADT: Add ilist_node::get{Prev,Next}Node, which return the adjacent node or null.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 12 May 2010 21:35:19 +0000 (21:35 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 12 May 2010 21:35:19 +0000 (21:35 +0000)
commitaa81380353a27d9d216cafdd88df08a5eef43b74
treef7ef143fdf660030e760607e80245e36d8a93c0e
parenta4d73d01c4850dce6a951228b13dcd8e733704b4
ADT: Add ilist_node::get{Prev,Next}Node, which return the adjacent node or null.
 - This provides a convenient alternative to using something llvm::prior or
   manual iterator access, for example::

    if (T *Prev = foo->getPrevNode())
      ...

   instead of::

     iterator it(foo);
     if (it != begin()) {
       --it;
       ...
     }

 - Chris, please review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103647 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/ilist_node.h
unittests/ADT/ilistTest.cpp [new file with mode: 0644]