raw_os_ostream.cpp 995 B

1234567891011121314151617181920212223242526272829
  1. //===--- raw_os_ostream.cpp - Implement the raw_os_ostream class ----------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This implements support adapting raw_ostream to std::ostream.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "llvm/Support/raw_os_ostream.h"
  13. #include <ostream>
  14. using namespace llvm;
  15. //===----------------------------------------------------------------------===//
  16. // raw_os_ostream
  17. //===----------------------------------------------------------------------===//
  18. raw_os_ostream::~raw_os_ostream() {
  19. flush();
  20. }
  21. void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
  22. OS.write(Ptr, Size);
  23. }
  24. uint64_t raw_os_ostream::current_pos() const { return OS.tellp(); }