[Lldb-commits] [lldb] 32cb683 - [lldb] Place PlatformQemu Properties into anonymous namespace

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 13 06:24:51 PDT 2022


Author: Pavel Labath
Date: 2022-10-13T15:23:58+02:00
New Revision: 32cb683d2d3aa9c8fe0f8b24bd3ad1a5ea53bdcc

URL: https://github.com/llvm/llvm-project/commit/32cb683d2d3aa9c8fe0f8b24bd3ad1a5ea53bdcc
DIFF: https://github.com/llvm/llvm-project/commit/32cb683d2d3aa9c8fe0f8b24bd3ad1a5ea53bdcc.diff

LOG: [lldb] Place PlatformQemu Properties into anonymous namespace

It's fine right now, but will break as soon as someone else declares a
PluginProperties class in the same way.

Also tighten up the scope of the anonymous namespaces surrounding the
other PluginProperties classes.

Added: 
    

Modified: 
    lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
    lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
    lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
index 26e73a7aeaede..3825c0bc09c77 100644
--- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -53,7 +53,6 @@ template <typename ptr_t> struct jit_descriptor {
 };
 
 namespace {
-
 enum EnableJITLoaderGDB {
   eEnableJITLoaderGDBDefault,
   eEnableJITLoaderGDBOn,
@@ -105,6 +104,7 @@ class PluginProperties : public Properties {
         g_jitloadergdb_properties[ePropertyEnable].default_uint_value);
   }
 };
+} // namespace
 
 static PluginProperties &GetGlobalPluginProperties() {
   static PluginProperties g_settings;
@@ -112,8 +112,8 @@ static PluginProperties &GetGlobalPluginProperties() {
 }
 
 template <typename ptr_t>
-bool ReadJITEntry(const addr_t from_addr, Process *process,
-                  jit_code_entry<ptr_t> *entry) {
+static bool ReadJITEntry(const addr_t from_addr, Process *process,
+                         jit_code_entry<ptr_t> *entry) {
   lldbassert(from_addr % sizeof(ptr_t) == 0);
 
   ArchSpec::Core core = process->GetTarget().GetArchitecture().GetCore();
@@ -142,8 +142,6 @@ bool ReadJITEntry(const addr_t from_addr, Process *process,
   return true;
 }
 
-} // anonymous namespace end
-
 JITLoaderGDB::JITLoaderGDB(lldb_private::Process *process)
     : JITLoader(process), m_jit_objects(),
       m_jit_break_id(LLDB_INVALID_BREAK_ID),

diff  --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 61c9b9f84272d..72fc82c3cd804 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -100,13 +100,13 @@ class PluginProperties : public Properties {
   }
 };
 
+} // namespace
+
 static PluginProperties &GetGlobalPluginProperties() {
   static PluginProperties g_settings;
   return g_settings;
 }
 
-} // namespace
-
 static bool GetDebugLinkContents(const llvm::object::COFFObjectFile &coff_obj,
                                  std::string &gnu_debuglink_file,
                                  uint32_t &gnu_debuglink_crc) {

diff  --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 7ee92ef76c9c7..4ba20117cdb56 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -23,6 +23,7 @@ using namespace lldb_private;
 
 LLDB_PLUGIN_DEFINE(PlatformQemuUser)
 
+namespace {
 #define LLDB_PROPERTIES_platformqemuuser
 #include "PlatformQemuUserProperties.inc"
 
@@ -71,6 +72,8 @@ class PluginProperties : public Properties {
   }
 };
 
+} // namespace
+
 static PluginProperties &GetGlobalProperties() {
   static PluginProperties g_settings;
   return g_settings;

diff  --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 6b9be1e55d4f2..88971e8336a17 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -83,13 +83,13 @@ class PluginProperties : public Properties {
   }
 };
 
+} // namespace
+
 static PluginProperties &GetGlobalPluginProperties() {
   static PluginProperties g_settings;
   return g_settings;
 }
 
-} // anonymous namespace end
-
 static const lldb::tid_t g_kernel_tid = 1;
 
 llvm::StringRef ProcessKDP::GetPluginDescriptionStatic() {

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index ecd9606106ba6..ba180cc821e29 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -166,13 +166,13 @@ class PluginProperties : public Properties {
   }
 };
 
+} // namespace
+
 static PluginProperties &GetGlobalPluginProperties() {
   static PluginProperties g_settings;
   return g_settings;
 }
 
-} // namespace
-
 // TODO Randomly assigning a port is unsafe.  We should get an unused
 // ephemeral port from the kernel and make sure we reserve it before passing it
 // to debugserver.

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 348b0e579869c..06c12454d9fd5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -130,13 +130,13 @@ class PluginProperties : public Properties {
   }
 };
 
+} // namespace
+
 static PluginProperties &GetGlobalPluginProperties() {
   static PluginProperties g_settings;
   return g_settings;
 }
 
-} // namespace
-
 static const llvm::DWARFDebugLine::LineTable *
 ParseLLVMLineTable(lldb_private::DWARFContext &context,
                    llvm::DWARFDebugLine &line, dw_offset_t line_offset,


        


More information about the lldb-commits mailing list