Files
llvm/lldb/source/Core/StreamCallback.cpp
Pavel Labath 5fae71c51c Convert Log class to llvm streams
Summary:
This converts LLDB's logging to use llvm streams instead of
lldb_private::Stream and friends. The changes are mostly
straight-forward and amount to s/lldb_private::Stream/llvm::raw_ostream.

The part worth calling out is the rewrite of the StreamCallback class.
Previously this class contained a per-thread buffer of data written. I
assume this had something to do with it trying to make sure each log
line is delivered as a single event, instead of multiple (possibly
interleaved) events. However, this is no longer relevant as the Log
class already writes things to a temporary buffer and then delivers the
message as a single "write", so I have just removed the code in
question.

Reviewers: zturner, clayborg

Subscribers: emaste, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D29615

llvm-svn: 294736
2017-02-10 11:49:21 +00:00

22 lines
742 B
C++

//===-- StreamCallback.cpp -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lldb/Core/StreamCallback.h"
using namespace lldb_private;
StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton)
: llvm::raw_ostream(true), m_callback(callback), m_baton(baton) {}
void StreamCallback::write_impl(const char *Ptr, size_t Size) {
m_callback(std::string(Ptr, Size).c_str(), m_baton);
}
uint64_t StreamCallback::current_pos() const { return 0; }