raw_ostream: << operator for callables with raw_stream argument
authorMatthias Braun <matze@braunis.de>
Thu, 3 Dec 2015 22:17:26 +0000 (22:17 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 3 Dec 2015 22:17:26 +0000 (22:17 +0000)
commitbb300c512008269c1caabff9613a6dbc49f83fa4
treeb62bce071086105f08af76a48dced41551d3a6b4
parent0956a120f5a443670cf86e59a6ad9dcff7135a9e
raw_ostream: << operator for callables with raw_stream argument

This allows easier construction of print helpers. Example:

Printable PrintLaneMask(unsigned LaneMask) {
  return Printable([LaneMask](raw_ostream &OS) {
    OS << format("%08X", LaneMask);
  });
}

// Usage:
OS << PrintLaneMask(Mask);

Differential Revision: http://reviews.llvm.org/D14348

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254655 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/raw_ostream.h
include/llvm/Target/TargetRegisterInfo.h
lib/CodeGen/RegAllocPBQP.cpp
lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
lib/CodeGen/TargetRegisterInfo.cpp
lib/Support/raw_ostream.cpp