diff options
| author | Matthias Braun <matze@braunis.de> | 2015-12-04 01:31:59 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2015-12-04 01:31:59 +0000 |
| commit | c07cbc8d3c92432e538ec7e6cc42dab04092c729 (patch) | |
| tree | d7cc8f46d445cb1561a01efa74913bc228c0faa5 /llvm/lib/CodeGen/SelectionDAG | |
| parent | 580b6572b574a9408cb52ad7b95a994857855a47 (diff) | |
| download | bcm5719-llvm-c07cbc8d3c92432e538ec7e6cc42dab04092c729.tar.gz bcm5719-llvm-c07cbc8d3c92432e538ec7e6cc42dab04092c729.zip | |
raw_ostream: << operator for callables with raw_ostream argument
This is a revised version of r254655 which uses a Printable wrapper
class to avoid ambiguous overload problems.
Differential Revision: http://reviews.llvm.org/D14348
llvm-svn: 254681
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp index d362f98d646..7c5492b554c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp @@ -22,6 +22,7 @@ #include "llvm/IR/Intrinsics.h" #include "llvm/Support/Debug.h" #include "llvm/Support/GraphWriter.h" +#include "llvm/Support/Printable.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetIntrinsicInfo.h" @@ -369,25 +370,14 @@ const char *SDNode::getIndexedModeName(ISD::MemIndexedMode AM) { } } -namespace { -class PrintNodeId { - const SDNode &Node; -public: - explicit PrintNodeId(const SDNode &Node) - : Node(Node) {} - void print(raw_ostream &OS) const { +static Printable PrintNodeId(const SDNode &Node) { + return Printable([&Node](raw_ostream &OS) { #ifndef NDEBUG OS << 't' << Node.PersistentId; #else OS << (const void*)&Node; #endif - } -}; - -static inline raw_ostream &operator<<(raw_ostream &OS, const PrintNodeId &P) { - P.print(OS); - return OS; -} + }); } void SDNode::dump() const { dump(nullptr); } |

