Remove the callback-based log channel registration mechanism
All the existing channels have beens switched to the new mechanism and
this code is now unused.
llvm-svn: 296333
diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp
index 89216f4..a69ae9b 100644
--- a/lldb/source/Core/Log.cpp
+++ b/lldb/source/Core/Log.cpp
@@ -222,16 +222,6 @@
free(arg_msg);
}
-typedef std::map<ConstString, Log::Callbacks> CallbackMap;
-typedef CallbackMap::iterator CallbackMapIter;
-
-// Surround our callback map with a singleton function so we don't have any
-// global initializers.
-static CallbackMap &GetCallbackMap() {
- static CallbackMap g_callback_map;
- return g_callback_map;
-}
-
void Log::Register(llvm::StringRef name, Channel &channel) {
auto iter = g_channel_map->try_emplace(name, channel);
assert(iter.second == true);
@@ -245,37 +235,10 @@
g_channel_map->erase(iter);
}
-void Log::RegisterLogChannel(const ConstString &channel,
- const Log::Callbacks &log_callbacks) {
- GetCallbackMap().insert(std::make_pair(channel, log_callbacks));
-}
-
-bool Log::UnregisterLogChannel(const ConstString &channel) {
- return GetCallbackMap().erase(channel) != 0;
-}
-
-bool Log::GetLogChannelCallbacks(const ConstString &channel,
- Log::Callbacks &log_callbacks) {
- CallbackMap &callback_map = GetCallbackMap();
- CallbackMapIter pos = callback_map.find(channel);
- if (pos != callback_map.end()) {
- log_callbacks = pos->second;
- return true;
- }
- ::memset(&log_callbacks, 0, sizeof(log_callbacks));
- return false;
-}
-
bool Log::EnableLogChannel(
const std::shared_ptr<llvm::raw_ostream> &log_stream_sp,
uint32_t log_options, llvm::StringRef channel, const char **categories,
Stream &error_stream) {
- Log::Callbacks log_callbacks;
- if (Log::GetLogChannelCallbacks(ConstString(channel), log_callbacks)) {
- log_callbacks.enable(log_stream_sp, log_options, categories, &error_stream);
- return true;
- }
-
auto iter = g_channel_map->find(channel);
if (iter == g_channel_map->end()) {
error_stream.Format("Invalid log channel '{0}'.\n", channel);
@@ -291,12 +254,6 @@
bool Log::DisableLogChannel(llvm::StringRef channel, const char **categories,
Stream &error_stream) {
- Log::Callbacks log_callbacks;
- if (Log::GetLogChannelCallbacks(ConstString(channel), log_callbacks)) {
- log_callbacks.disable(categories, &error_stream);
- return true;
- }
-
auto iter = g_channel_map->find(channel);
if (iter == g_channel_map->end()) {
error_stream.Format("Invalid log channel '{0}'.\n", channel);
@@ -310,12 +267,6 @@
}
bool Log::ListChannelCategories(llvm::StringRef channel, Stream &stream) {
- Log::Callbacks log_callbacks;
- if (Log::GetLogChannelCallbacks(ConstString(channel), log_callbacks)) {
- log_callbacks.list_categories(&stream);
- return true;
- }
-
auto ch = g_channel_map->find(channel);
if (ch == g_channel_map->end()) {
stream.Format("Invalid log channel '{0}'.\n", channel);
@@ -326,29 +277,16 @@
}
void Log::DisableAllLogChannels(Stream *feedback_strm) {
- CallbackMap &callback_map = GetCallbackMap();
- CallbackMapIter pos, end = callback_map.end();
- const char *categories[] = {"all", nullptr};
-
- for (pos = callback_map.begin(); pos != end; ++pos)
- pos->second.disable(categories, feedback_strm);
-
for (auto &entry : *g_channel_map)
entry.second.channel.Disable(UINT32_MAX);
}
void Log::ListAllLogChannels(Stream *strm) {
- CallbackMap &callback_map = GetCallbackMap();
-
- if (callback_map.empty() && g_channel_map->empty()) {
+ if (g_channel_map->empty()) {
strm->PutCString("No logging channels are currently registered.\n");
return;
}
- CallbackMapIter pos, end = callback_map.end();
- for (pos = callback_map.begin(); pos != end; ++pos)
- pos->second.list_categories(strm);
-
for (const auto &channel : *g_channel_map)
ListCategories(*strm, channel);
}