JDevlieghere created this revision.
JDevlieghere added a reviewer: labath.
Herald added a project: All.
JDevlieghere requested review of this revision.

Avoid a static initializer for Log::Channel in LLDBLog.cpp


https://reviews.llvm.org/D121161

Files:
  lldb/source/Utility/LLDBLog.cpp


Index: lldb/source/Utility/LLDBLog.cpp
===================================================================
--- lldb/source/Utility/LLDBLog.cpp
+++ lldb/source/Utility/LLDBLog.cpp
@@ -62,18 +62,16 @@
     {{"watch"}, {"log watchpoint related activities"}, LLDBLog::Watchpoints},
 };
 
-static Log::Channel g_log_channel(g_categories,
-                                  LLDBLog::Process | LLDBLog::Thread |
-                                      LLDBLog::DynamicLoader |
-                                      LLDBLog::Breakpoints |
-                                      LLDBLog::Watchpoints | LLDBLog::Step |
-                                      LLDBLog::State | LLDBLog::Symbols |
-                                      LLDBLog::Target | LLDBLog::Commands);
 
 template <> Log::Channel &lldb_private::LogChannelFor<LLDBLog>() {
+  static Log::Channel g_log_channel(
+      g_categories, LLDBLog::Process | LLDBLog::Thread |
+                        LLDBLog::DynamicLoader | LLDBLog::Breakpoints |
+                        LLDBLog::Watchpoints | LLDBLog::Step | LLDBLog::State |
+                        LLDBLog::Symbols | LLDBLog::Target | 
LLDBLog::Commands);
   return g_log_channel;
 }
 
 void lldb_private::InitializeLldbChannel() {
-  Log::Register("lldb", g_log_channel);
+  Log::Register("lldb", lldb_private::LogChannelFor<LLDBLog>());
 }


Index: lldb/source/Utility/LLDBLog.cpp
===================================================================
--- lldb/source/Utility/LLDBLog.cpp
+++ lldb/source/Utility/LLDBLog.cpp
@@ -62,18 +62,16 @@
     {{"watch"}, {"log watchpoint related activities"}, LLDBLog::Watchpoints},
 };
 
-static Log::Channel g_log_channel(g_categories,
-                                  LLDBLog::Process | LLDBLog::Thread |
-                                      LLDBLog::DynamicLoader |
-                                      LLDBLog::Breakpoints |
-                                      LLDBLog::Watchpoints | LLDBLog::Step |
-                                      LLDBLog::State | LLDBLog::Symbols |
-                                      LLDBLog::Target | LLDBLog::Commands);
 
 template <> Log::Channel &lldb_private::LogChannelFor<LLDBLog>() {
+  static Log::Channel g_log_channel(
+      g_categories, LLDBLog::Process | LLDBLog::Thread |
+                        LLDBLog::DynamicLoader | LLDBLog::Breakpoints |
+                        LLDBLog::Watchpoints | LLDBLog::Step | LLDBLog::State |
+                        LLDBLog::Symbols | LLDBLog::Target | LLDBLog::Commands);
   return g_log_channel;
 }
 
 void lldb_private::InitializeLldbChannel() {
-  Log::Register("lldb", g_log_channel);
+  Log::Register("lldb", lldb_private::LogChannelFor<LLDBLog>());
 }
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to