X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FCodeGen%2FSelectionDAG%2FSelectionDAGDumper.cpp;h=7c5492b554c2aea850c6bec52fafcdeff3069d92;hp=d362f98d6464e6297bc1e57e80afa779161c66a9;hb=ae4aa8b8d233366d231a10dafae68d7287512927;hpb=2012083871b75ca032fefaec739ce1f280a8f3de diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp index d362f98d646..7c5492b554c 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp +++ b/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); }