Move several plugin to its own namespace
Affected paths:
- Plugins/Platform/Android/*
- Plugins/Platform/Linux/*
- Plugins/Platform/gdb-server/*
- Plugins/Process/Linux/*
- Plugins/Process/gdb-remote/*
Paths
| Differential D8654
Move several plugin to its own namespace ClosedPublic Authored by tberghammer on Mar 27 2015, 3:28 AM.
Details Summary Move several plugin to its own namespace Affected paths:
Diff Detail
Event Timelinetberghammer retitled this revision from to Move lot of class from the global namespace into lldb_private. tberghammer updated this object. Comment Actions The main question is do we want to move each plug-in into its own namespace within lldb_private namespace? All code from the GDB remote process plug-in could be in: namespace lldb_private { namespace plugin { namespace process { namespace gdb_remote { // Code here } } } } Or just namespace lldb_private { namespace process_gdb_remote { // Code here } } This revision is now accepted and ready to land.Mar 27 2015, 9:55 AM Comment Actions
I am not sure if moving each plugin into its own namespace will make too much sense because most of the plugin is very small (1 or 2 cpp file) so the additional namespaces just adding some noise to the code without any real benefit. What I would consider is to leave the public part of the plugins directly in the lldb_private namespace and if a plugin require additional classes which are private to the plugin then put them into a nested namespace inside lldb_private. From the two namespace structure you suggested I would prefer the second one as the first one create a very deep nesting so if we have to refer to a plugin from a header file outside of that plugin (e.g.: from a platform plugin to a process plugin) then it will create extremely long fully qualified names. If we want to go with adding nested namespace then I would also consider the following structures because the plugins for the same OS usually tied together in some level: namespace lldb_private { namespace linux { namespace process { // Code here } } } Or just an OS level separation (then we don't have to postfix almost all class with the OS name as ProcessLinux, PlatformWindows, ...) namespace lldb_private { namespace linux { // Code here } } Comment Actions I would prefer each plug-in use its own namespace, even if the the shallow version is fine. I would just like people to see the error of their ways if they are in ProcessLinux.cpp and you see: lldb_private::gdb_remote::something(); or if "using namespace lldb_private;": gdb_remote::something(); This should be a good indication that the abstraction was broken since you are in ProcessLinux.cpp and you are accessing code from a plug-in. Where as if you saw: lldb_private::something(); or if "using namespace lldb_private;": something(); You might think the above code would be OK since it is in the lldb_private namespace, whereas seeing "gdb_remote" namespace quickly tells you something is up. tberghammer retitled this revision from Move lot of class from the global namespace into lldb_private to Move several plugin to its own namespace. tberghammer updated this object. tberghammer edited edge metadata. Comment ActionsMove plugins to their own namespace This change exposed several flows in the current design (mostly classes leaving in the wrong place). I will try to fix them in the future when I have some time for it. Closed by commit rL233679: Move several plugin to its own namespace (authored by tberghammer). · Explain WhyMar 31 2015, 2:55 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 22934 lldb/trunk/source/Host/linux/Host.cpp
lldb/trunk/source/Host/linux/HostThreadLinux.cpp
lldb/trunk/source/Initialization/InitializeLLDB.cpp
lldb/trunk/source/Plugins/Platform/Android/AdbClient.h
lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h
lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.h
lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h
lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/Linux/ThreadStateCoordinator.h
lldb/trunk/source/Plugins/Process/Linux/ThreadStateCoordinator.cpp
lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.h
lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
lldb/trunk/tools/lldb-server/lldb-platform.cpp
|