[Lldb-commits] [lldb] Start to clean up the process of defining command arguments. (PR #83097)

via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 26 18:28:22 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff dc06d75ab27b4dcae2940fc386fadd06f70faffe 2ed71038d9d16a09b3a04cf667dd272c911fef23 -- lldb/include/lldb/Interpreter/CommandObject.h lldb/source/Commands/CommandObjectApropos.cpp lldb/source/Commands/CommandObjectBreakpoint.cpp lldb/source/Commands/CommandObjectBreakpointCommand.cpp lldb/source/Commands/CommandObjectCommands.cpp lldb/source/Commands/CommandObjectDWIMPrint.cpp lldb/source/Commands/CommandObjectExpression.cpp lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Commands/CommandObjectHelp.cpp lldb/source/Commands/CommandObjectLog.cpp lldb/source/Commands/CommandObjectPlatform.cpp lldb/source/Commands/CommandObjectPlugin.cpp lldb/source/Commands/CommandObjectProcess.cpp lldb/source/Commands/CommandObjectQuit.cpp lldb/source/Commands/CommandObjectRegister.cpp lldb/source/Commands/CommandObjectSession.cpp lldb/source/Commands/CommandObjectSettings.cpp lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Commands/CommandObjectThreadUtil.cpp lldb/source/Commands/CommandObjectTrace.cpp lldb/source/Commands/CommandObjectType.cpp lldb/source/Commands/CommandObjectWatchpoint.cpp lldb/source/Commands/CommandObjectWatchpointCommand.cpp lldb/source/Interpreter/CommandObject.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h
index 49cf4a21e2..a641a468b4 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -206,10 +206,11 @@ public:
 
   static const ArgumentTableEntry *
   FindArgumentDataByType(lldb::CommandArgumentType arg_type);
-  
+
   // Sets the argument list for this command to one homogenous argument type,
   // with the repeat specified.
-  void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, 
+  void AddSimpleArgumentList(
+      lldb::CommandArgumentType arg_type,
       ArgumentRepetitionType repetition_type = eArgRepeatPlain);
 
   // Helper function to set BP IDs or ID ranges as the command argument data
@@ -217,10 +218,7 @@ public:
   // This used to just populate an entry you could add to, but that was never
   // used.  If we ever need that we can take optional extra args here.
   // Use this to define a simple argument list:
-  enum IDType {
-    eBreakpointArgs = 0,
-    eWatchpointArgs = 1
-  };
+  enum IDType { eBreakpointArgs = 0, eWatchpointArgs = 1 };
   void AddIDsArgumentData(IDType type);
 
   int GetNumArgumentEntries();
@@ -407,7 +405,6 @@ protected:
   lldb_private::CommandOverrideCallbackWithResult m_command_override_callback;
   void *m_command_override_baton;
   bool m_is_user_command = false;
-
 };
 
 class CommandObjectParsed : public CommandObject {
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index 2c6e6e1d44..4634b75c6a 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -392,9 +392,9 @@ bool CommandObject::ParseOptionsAndNotify(Args &args,
   return true;
 }
 
-void CommandObject::AddSimpleArgumentList(CommandArgumentType arg_type, 
-                                     ArgumentRepetitionType repetition_type) {
-                        
+void CommandObject::AddSimpleArgumentList(
+    CommandArgumentType arg_type, ArgumentRepetitionType repetition_type) {
+
   CommandArgumentEntry arg_entry;
   CommandArgumentData simple_arg;
 
@@ -720,14 +720,14 @@ void CommandObject::AddIDsArgumentData(CommandObject::IDType type) {
   // Create the first variant for the first (and only) argument for this
   // command.
   switch (type) {
-    case eBreakpointArgs:
-      id_arg.arg_type = eArgTypeBreakpointID;
-      id_range_arg.arg_type = eArgTypeBreakpointIDRange;
-      break;
-    case eWatchpointArgs:
-      id_arg.arg_type = eArgTypeWatchpointID;
-      id_range_arg.arg_type = eArgTypeWatchpointIDRange;
-      break;
+  case eBreakpointArgs:
+    id_arg.arg_type = eArgTypeBreakpointID;
+    id_range_arg.arg_type = eArgTypeBreakpointIDRange;
+    break;
+  case eWatchpointArgs:
+    id_arg.arg_type = eArgTypeWatchpointID;
+    id_range_arg.arg_type = eArgTypeWatchpointIDRange;
+    break;
   }
   id_arg.arg_repetition = eArgRepeatOptional;
   id_range_arg.arg_repetition = eArgRepeatOptional;

``````````

</details>


https://github.com/llvm/llvm-project/pull/83097


More information about the lldb-commits mailing list