diff options
| author | Pavel Labath <labath@google.com> | 2017-02-10 11:49:21 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2017-02-10 11:49:21 +0000 |
| commit | 5fae71c51cc8c3d51e86cd597ce91a254e9175f4 (patch) | |
| tree | 07566b6e6ea25ad4cd1fe0138e69b3b15650d072 /lldb/unittests/Core/StreamCallbackTest.cpp | |
| parent | 30a02088c0dcf07dcb38bc9fd2f8221154cff449 (diff) | |
| download | bcm5719-llvm-5fae71c51cc8c3d51e86cd597ce91a254e9175f4.tar.gz bcm5719-llvm-5fae71c51cc8c3d51e86cd597ce91a254e9175f4.zip | |
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
Diffstat (limited to 'lldb/unittests/Core/StreamCallbackTest.cpp')
| -rw-r--r-- | lldb/unittests/Core/StreamCallbackTest.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/unittests/Core/StreamCallbackTest.cpp b/lldb/unittests/Core/StreamCallbackTest.cpp new file mode 100644 index 00000000000..4ef14aaeb54 --- /dev/null +++ b/lldb/unittests/Core/StreamCallbackTest.cpp @@ -0,0 +1,28 @@ +//===-- StreamCallbackTest.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" +#include "gtest/gtest.h" + +using namespace lldb; +using namespace lldb_private; + +static char test_baton; +static size_t callback_count = 0; +static void TestCallback(const char *data, void *baton) { + EXPECT_STREQ("Foobar", data); + EXPECT_EQ(&test_baton, baton); + ++callback_count; +} + +TEST(StreamCallbackTest, Callback) { + StreamCallback stream(TestCallback, &test_baton); + stream << "Foobar"; + EXPECT_EQ(1u, callback_count); +} |

