From: Bill Wendling Date: Sun, 26 Nov 2006 10:51:51 +0000 (+0000) Subject: Add method that will take a function pointer so that it can handle things X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=7fe9518698d4b07fb9dd81f5a34f312d690539cc;p=oota-llvm.git Add method that will take a function pointer so that it can handle things like "llvm_cerr << std::flush"; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31926 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/Streams.h b/include/llvm/Support/Streams.h index 5af96fdff3a..138a0701497 100644 --- a/include/llvm/Support/Streams.h +++ b/include/llvm/Support/Streams.h @@ -29,6 +29,13 @@ namespace llvm { llvm_ostream() : Stream(0) {} llvm_ostream(std::ostream &OStream) : Stream(&OStream) {} + std::ostream* stream() const { return Stream; } + + inline llvm_ostream &operator << (std::ostream& (*Func)(std::ostream&)) { + *Stream << Func; + return *this; + } + template llvm_ostream &operator << (const Ty &Thing) { if (Stream) *Stream << Thing;