[lldb] Place PlatformQemu Properties into anonymous namespace
authorPavel Labath <pavel@labath.sk>
Thu, 13 Oct 2022 13:22:22 +0000 (15:22 +0200)
committerPavel Labath <pavel@labath.sk>
Thu, 13 Oct 2022 13:23:58 +0000 (15:23 +0200)
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.

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

index 26e73a7aeaede4179b9077390724151f2f4454f5..3825c0bc09c77a77b30e560376721d034cc4112a 100644 (file)
@@ -53,7 +53,6 @@ template <typename ptr_t> struct jit_descriptor {
 };
 
 namespace {
-
 enum EnableJITLoaderGDB {
   eEnableJITLoaderGDBDefault,
   eEnableJITLoaderGDBOn,
@@ -105,6 +104,7 @@ public:
         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),
index 61c9b9f84272dad7eb7ce22a2ace5b22980196ba..72fc82c3cd804b29a9c6963f0272fdecde35a61e 100644 (file)
@@ -100,13 +100,13 @@ public:
   }
 };
 
+} // 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) {
index 7ee92ef76c9c77e7c12e3b53573c93f6575396af..4ba20117cdb5666521d1c4af55750b53c480a5f5 100644 (file)
@@ -23,6 +23,7 @@ using namespace lldb_private;
 
 LLDB_PLUGIN_DEFINE(PlatformQemuUser)
 
+namespace {
 #define LLDB_PROPERTIES_platformqemuuser
 #include "PlatformQemuUserProperties.inc"
 
@@ -71,6 +72,8 @@ public:
   }
 };
 
+} // namespace
+
 static PluginProperties &GetGlobalProperties() {
   static PluginProperties g_settings;
   return g_settings;
index 6b9be1e55d4f25df94fe719fa86a559e4ab65407..88971e8336a17ef1eaad1028cbe2c12183406b7a 100644 (file)
@@ -83,13 +83,13 @@ public:
   }
 };
 
+} // 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() {
index ecd9606106ba6c78e32497ccac55163d943c3be2..ba180cc821e29fa6e21a21ce78ea138ffbf86685 100644 (file)
@@ -166,13 +166,13 @@ public:
   }
 };
 
+} // 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.
index 348b0e579869c70be0df3a18974761bcb479e7e3..06c12454d9fd5d83c217004922aa975e5e3a3352 100644 (file)
@@ -130,13 +130,13 @@ public:
   }
 };
 
+} // 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,