Files
llvm/lldb/source/Core/StreamAsynchronousIO.cpp
Zachary Turner 2f3df6137a iwyu fixes for lldbCore.
This adjusts header file includes for headers and source files
in Core.  In doing so, one dependency cycle is eliminated
because all the includes from Core to that project were dead
includes anyway.  In places where some files in other projects
were only compiling due to a transitive include from another
header, fixups have been made so that those files also include
the header they need.  Tested on Windows and Linux, and plan
to address failures on OSX and FreeBSD after watching the
bots.

llvm-svn: 299714
2017-04-06 21:28:29 +00:00

38 lines
1.1 KiB
C++

//===-- StreamAsynchronousIO.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/StreamAsynchronousIO.h"
#include "lldb/Core/Debugger.h"
#include "lldb/lldb-enumerations.h" // for ByteOrder::eByteOrderBig
using namespace lldb;
using namespace lldb_private;
StreamAsynchronousIO::StreamAsynchronousIO(Debugger &debugger, bool for_stdout)
: Stream(0, 4, eByteOrderBig), m_debugger(debugger), m_data(),
m_for_stdout(for_stdout) {}
StreamAsynchronousIO::~StreamAsynchronousIO() {
// Flush when we destroy to make sure we display the data
Flush();
}
void StreamAsynchronousIO::Flush() {
if (!m_data.empty()) {
m_debugger.PrintAsync(m_data.data(), m_data.size(), m_for_stdout);
m_data = std::string();
}
}
size_t StreamAsynchronousIO::Write(const void *s, size_t length) {
m_data.append((const char *)s, length);
return length;
}