[Lldb-commits] [lldb] 13b58f9 - [lldb] Remove Log:Channel::GetLogIfAll
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 4 04:31:31 PST 2022
Author: Pavel Labath
Date: 2022-02-04T13:31:14+01:00
New Revision: 13b58f9710564b7abff1b62dc87e48de70df7f7c
URL: https://github.com/llvm/llvm-project/commit/13b58f9710564b7abff1b62dc87e48de70df7f7c
DIFF: https://github.com/llvm/llvm-project/commit/13b58f9710564b7abff1b62dc87e48de70df7f7c.diff
LOG: [lldb] Remove Log:Channel::GetLogIfAll
after the recent refactor, the function is unused.
Added:
Modified:
lldb/include/lldb/Utility/Log.h
lldb/unittests/Utility/LogTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h
index c0e551077b2e1..1ab12e0cfc1a1 100644
--- a/lldb/include/lldb/Utility/Log.h
+++ b/lldb/include/lldb/Utility/Log.h
@@ -97,18 +97,7 @@ class Log final {
// after (or concurrently with) this function returning a non-null Log
// pointer, it is still safe to attempt to write to the Log object -- the
// output will be discarded.
- Log *GetLogIfAll(MaskType mask) {
- Log *log = log_ptr.load(std::memory_order_relaxed);
- if (log && log->GetMask().AllSet(mask))
- return log;
- return nullptr;
- }
-
- // This function is safe to call at any time. If the channel is disabled
- // after (or concurrently with) this function returning a non-null Log
- // pointer, it is still safe to attempt to write to the Log object -- the
- // output will be discarded.
- Log *GetLogIfAny(MaskType mask) {
+ Log *GetLog(MaskType mask) {
Log *log = log_ptr.load(std::memory_order_relaxed);
if (log && log->GetMask().AnySet(mask))
return log;
@@ -246,7 +235,7 @@ template <typename Cat> Log::Channel &LogChannelFor() = delete;
template <typename Cat> Log *GetLog(Cat mask) {
static_assert(std::is_same<Log::MaskType, std::underlying_type_t<Cat>>::value,
"");
- return LogChannelFor<Cat>().GetLogIfAny(Log::MaskType(mask));
+ return LogChannelFor<Cat>().GetLog(Log::MaskType(mask));
}
} // namespace lldb_private
diff --git a/lldb/unittests/Utility/LogTest.cpp b/lldb/unittests/Utility/LogTest.cpp
index 51ca0fbce4ff7..533f8620c46f5 100644
--- a/lldb/unittests/Utility/LogTest.cpp
+++ b/lldb/unittests/Utility/LogTest.cpp
@@ -158,16 +158,15 @@ TEST_F(LogChannelTest, Enable) {
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {}, error));
EXPECT_NE(nullptr, GetLog(TestChannel::FOO));
EXPECT_EQ(nullptr, GetLog(TestChannel::BAR));
+ EXPECT_NE(nullptr, GetLog(TestChannel::FOO | TestChannel::BAR));
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"bar"}, error));
- EXPECT_NE(nullptr, test_channel.GetLogIfAll(
- Log::MaskType(TestChannel::FOO | TestChannel::BAR)));
+ EXPECT_NE(nullptr, GetLog(TestChannel::FOO));
+ EXPECT_NE(nullptr, GetLog(TestChannel::BAR));
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"baz"}, error));
EXPECT_NE(std::string::npos, error.find("unrecognized log category 'baz'"))
<< "error: " << error;
- EXPECT_NE(nullptr, test_channel.GetLogIfAll(
- Log::MaskType(TestChannel::FOO | TestChannel::BAR)));
}
TEST_F(LogChannelTest, EnableOptions) {
@@ -191,8 +190,8 @@ TEST_F(LogChannelTest, Disable) {
new llvm::raw_string_ostream(message));
std::string error;
EXPECT_TRUE(EnableChannel(stream_sp, 0, "chan", {"foo", "bar"}, error));
- EXPECT_NE(nullptr, test_channel.GetLogIfAll(
- Log::MaskType(TestChannel::FOO | TestChannel::BAR)));
+ EXPECT_NE(nullptr, GetLog(TestChannel::FOO));
+ EXPECT_NE(nullptr, GetLog(TestChannel::BAR));
EXPECT_TRUE(DisableChannel("chan", {"bar"}, error));
EXPECT_NE(nullptr, GetLog(TestChannel::FOO));
More information about the lldb-commits
mailing list