From 13b58f9710564b7abff1b62dc87e48de70df7f7c Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 3 Feb 2022 14:54:13 +0100 Subject: [PATCH] [lldb] Remove Log:Channel::GetLogIfAll after the recent refactor, the function is unused. --- lldb/include/lldb/Utility/Log.h | 15 ++------------- lldb/unittests/Utility/LogTest.cpp | 11 +++++------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h index c0e5510..1ab12e0 100644 --- a/lldb/include/lldb/Utility/Log.h +++ b/lldb/include/lldb/Utility/Log.h @@ -97,18 +97,7 @@ public: // 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 Log::Channel &LogChannelFor() = delete; template Log *GetLog(Cat mask) { static_assert(std::is_same>::value, ""); - return LogChannelFor().GetLogIfAny(Log::MaskType(mask)); + return LogChannelFor().GetLog(Log::MaskType(mask)); } } // namespace lldb_private diff --git a/lldb/unittests/Utility/LogTest.cpp b/lldb/unittests/Utility/LogTest.cpp index 51ca0fb..533f862 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)); -- 2.7.4