diff options
Diffstat (limited to 'llvm/lib/Support/raw_os_ostream.cpp')
-rw-r--r-- | llvm/lib/Support/raw_os_ostream.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/Support/raw_os_ostream.cpp b/llvm/lib/Support/raw_os_ostream.cpp new file mode 100644 index 000000000000..81f0d739696e --- /dev/null +++ b/llvm/lib/Support/raw_os_ostream.cpp @@ -0,0 +1,29 @@ +//===--- raw_os_ostream.cpp - Implement the raw_os_ostream class ----------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This implements support adapting raw_ostream to std::ostream. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/raw_os_ostream.h" +#include <ostream> +using namespace llvm; + +//===----------------------------------------------------------------------===// +// raw_os_ostream +//===----------------------------------------------------------------------===// + +raw_os_ostream::~raw_os_ostream() { + flush(); +} + +void raw_os_ostream::write_impl(const char *Ptr, size_t Size) { + OS.write(Ptr, Size); +} + +uint64_t raw_os_ostream::current_pos() const { return OS.tellp(); } |