diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 21:17:53 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 21:17:53 +0000 |
commit | 34ccf037fea3d83dcb18f72496775ec4c7dcd3d3 (patch) | |
tree | 4f75f7867037c4f79ccc87b69abeee324a26f445 /lib | |
parent | 32360a7e21a4454aa7014992213823fb4319905a (diff) | |
download | external_llvm-34ccf037fea3d83dcb18f72496775ec4c7dcd3d3.zip external_llvm-34ccf037fea3d83dcb18f72496775ec4c7dcd3d3.tar.gz external_llvm-34ccf037fea3d83dcb18f72496775ec4c7dcd3d3.tar.bz2 |
Add raw_null_ostream and llvm::nulls(), a raw_ostream that discards output.
- No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Support/raw_ostream.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 397d296..3cec18b 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -375,6 +375,12 @@ raw_ostream &llvm::errs() { return S; } +/// nulls() - This returns a reference to a raw_ostream which discards output. +raw_ostream &llvm::nulls() { + static raw_null_ostream S; + return S; +} + //===----------------------------------------------------------------------===// // raw_os_ostream //===----------------------------------------------------------------------===// @@ -422,3 +428,14 @@ uint64_t raw_svector_ostream::current_pos() { return OS.size(); } uint64_t raw_svector_ostream::tell() { return OS.size() + GetNumBytesInBuffer(); } + +//===----------------------------------------------------------------------===// +// raw_null_ostream +//===----------------------------------------------------------------------===// + +void raw_null_ostream::write_impl(const char *Ptr, size_t Size) { +} + +uint64_t raw_null_ostream::current_pos() { + return 0; +} |