JDevlieghere created this revision.
JDevlieghere added reviewers: zturner, labath, davide.
Herald added a project: LLDB.

Inspired by Zachary's mail on lldb-dev, this seemed like low hanging fruit. 
This patch breaks the circular dependency between commands and expression.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59158

Files:
  lldb/include/lldb/Commands/CommandObjectApropos.h
  lldb/include/lldb/Commands/CommandObjectBreakpoint.h
  lldb/include/lldb/Commands/CommandObjectBreakpointCommand.h
  lldb/include/lldb/Commands/CommandObjectBugreport.h
  lldb/include/lldb/Commands/CommandObjectCommands.h
  lldb/include/lldb/Commands/CommandObjectDisassemble.h
  lldb/include/lldb/Commands/CommandObjectExpression.h
  lldb/include/lldb/Commands/CommandObjectFrame.h
  lldb/include/lldb/Commands/CommandObjectGUI.h
  lldb/include/lldb/Commands/CommandObjectHelp.h
  lldb/include/lldb/Commands/CommandObjectLanguage.h
  lldb/include/lldb/Commands/CommandObjectLog.h
  lldb/include/lldb/Commands/CommandObjectMemory.h
  lldb/include/lldb/Commands/CommandObjectPlatform.h
  lldb/include/lldb/Commands/CommandObjectPlugin.h
  lldb/include/lldb/Commands/CommandObjectProcess.h
  lldb/include/lldb/Commands/CommandObjectQuit.h
  lldb/include/lldb/Commands/CommandObjectRegister.h
  lldb/include/lldb/Commands/CommandObjectReproducer.h
  lldb/include/lldb/Commands/CommandObjectSettings.h
  lldb/include/lldb/Commands/CommandObjectSource.h
  lldb/include/lldb/Commands/CommandObjectStats.h
  lldb/include/lldb/Commands/CommandObjectTarget.h
  lldb/include/lldb/Commands/CommandObjectThread.h
  lldb/include/lldb/Commands/CommandObjectType.h
  lldb/include/lldb/Commands/CommandObjectVersion.h
  lldb/include/lldb/Commands/CommandObjectWatchpoint.h
  lldb/include/lldb/Commands/CommandObjectWatchpointCommand.h
  lldb/include/lldb/Expression/REPL.h
  lldb/source/API/SBTarget.cpp
  lldb/source/Commands/CommandObjectApropos.cpp
  lldb/source/Commands/CommandObjectApropos.h
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/CommandObjectBreakpoint.h
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.h
  lldb/source/Commands/CommandObjectBugreport.cpp
  lldb/source/Commands/CommandObjectBugreport.h
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectCommands.h
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectDisassemble.h
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectExpression.h
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectFrame.h
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectGUI.h
  lldb/source/Commands/CommandObjectHelp.cpp
  lldb/source/Commands/CommandObjectHelp.h
  lldb/source/Commands/CommandObjectLanguage.cpp
  lldb/source/Commands/CommandObjectLanguage.h
  lldb/source/Commands/CommandObjectLog.cpp
  lldb/source/Commands/CommandObjectLog.h
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Commands/CommandObjectMemory.h
  lldb/source/Commands/CommandObjectPlatform.cpp
  lldb/source/Commands/CommandObjectPlatform.h
  lldb/source/Commands/CommandObjectPlugin.cpp
  lldb/source/Commands/CommandObjectPlugin.h
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/CommandObjectProcess.h
  lldb/source/Commands/CommandObjectQuit.cpp
  lldb/source/Commands/CommandObjectQuit.h
  lldb/source/Commands/CommandObjectRegister.cpp
  lldb/source/Commands/CommandObjectRegister.h
  lldb/source/Commands/CommandObjectReproducer.cpp
  lldb/source/Commands/CommandObjectReproducer.h
  lldb/source/Commands/CommandObjectSettings.cpp
  lldb/source/Commands/CommandObjectSettings.h
  lldb/source/Commands/CommandObjectSource.cpp
  lldb/source/Commands/CommandObjectSource.h
  lldb/source/Commands/CommandObjectStats.cpp
  lldb/source/Commands/CommandObjectStats.h
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectTarget.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectThread.h
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectType.h
  lldb/source/Commands/CommandObjectVersion.cpp
  lldb/source/Commands/CommandObjectVersion.h
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpoint.h
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.h
  lldb/source/Expression/REPL.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp

Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -14,32 +14,32 @@
 #include "CommandObjectScript.h"
 #include "lldb/Interpreter/CommandObjectRegexCommand.h"
 
-#include "Commands/CommandObjectApropos.h"
-#include "Commands/CommandObjectBreakpoint.h"
-#include "Commands/CommandObjectBugreport.h"
-#include "Commands/CommandObjectCommands.h"
-#include "Commands/CommandObjectDisassemble.h"
-#include "Commands/CommandObjectExpression.h"
-#include "Commands/CommandObjectFrame.h"
-#include "Commands/CommandObjectGUI.h"
-#include "Commands/CommandObjectHelp.h"
-#include "Commands/CommandObjectLanguage.h"
-#include "Commands/CommandObjectLog.h"
-#include "Commands/CommandObjectMemory.h"
-#include "Commands/CommandObjectPlatform.h"
-#include "Commands/CommandObjectPlugin.h"
-#include "Commands/CommandObjectProcess.h"
-#include "Commands/CommandObjectQuit.h"
-#include "Commands/CommandObjectRegister.h"
-#include "Commands/CommandObjectReproducer.h"
-#include "Commands/CommandObjectSettings.h"
-#include "Commands/CommandObjectSource.h"
-#include "Commands/CommandObjectStats.h"
-#include "Commands/CommandObjectTarget.h"
-#include "Commands/CommandObjectThread.h"
-#include "Commands/CommandObjectType.h"
-#include "Commands/CommandObjectVersion.h"
-#include "Commands/CommandObjectWatchpoint.h"
+#include "lldb/Commands/CommandObjectApropos.h"
+#include "lldb/Commands/CommandObjectBreakpoint.h"
+#include "lldb/Commands/CommandObjectBugreport.h"
+#include "lldb/Commands/CommandObjectCommands.h"
+#include "lldb/Commands/CommandObjectDisassemble.h"
+#include "lldb/Commands/CommandObjectExpression.h"
+#include "lldb/Commands/CommandObjectFrame.h"
+#include "lldb/Commands/CommandObjectGUI.h"
+#include "lldb/Commands/CommandObjectHelp.h"
+#include "lldb/Commands/CommandObjectLanguage.h"
+#include "lldb/Commands/CommandObjectLog.h"
+#include "lldb/Commands/CommandObjectMemory.h"
+#include "lldb/Commands/CommandObjectPlatform.h"
+#include "lldb/Commands/CommandObjectPlugin.h"
+#include "lldb/Commands/CommandObjectProcess.h"
+#include "lldb/Commands/CommandObjectQuit.h"
+#include "lldb/Commands/CommandObjectRegister.h"
+#include "lldb/Commands/CommandObjectReproducer.h"
+#include "lldb/Commands/CommandObjectSettings.h"
+#include "lldb/Commands/CommandObjectSource.h"
+#include "lldb/Commands/CommandObjectStats.h"
+#include "lldb/Commands/CommandObjectTarget.h"
+#include "lldb/Commands/CommandObjectThread.h"
+#include "lldb/Commands/CommandObjectType.h"
+#include "lldb/Commands/CommandObjectVersion.h"
+#include "lldb/Commands/CommandObjectWatchpoint.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/PluginManager.h"
Index: lldb/source/Expression/REPL.cpp
===================================================================
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Expression/REPL.h"
+#include "lldb/Commands/CommandObjectExpression.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/StreamFile.h"
@@ -23,22 +24,29 @@
 
 using namespace lldb_private;
 
-REPL::REPL(LLVMCastKind kind, Target &target) : m_target(target), m_kind(kind) {
+REPL::REPL(LLVMCastKind kind, Target &target)
+    : m_command_options(new CommandObjectExpressionOptions()), m_target(target),
+      m_kind(kind) {
   // Make sure all option values have sane defaults
   Debugger &debugger = m_target.GetDebugger();
   auto exe_ctx = debugger.GetCommandInterpreter().GetExecutionContext();
   m_format_options.OptionParsingStarting(&exe_ctx);
   m_varobj_options.OptionParsingStarting(&exe_ctx);
-  m_command_options.OptionParsingStarting(&exe_ctx);
+  m_command_options->OptionParsingStarting(&exe_ctx);
 
   // Default certain settings for REPL regardless of the global settings.
-  m_command_options.unwind_on_error = false;
-  m_command_options.ignore_breakpoints = false;
-  m_command_options.debug = false;
+  m_command_options->unwind_on_error = false;
+  m_command_options->ignore_breakpoints = false;
+  m_command_options->debug = false;
 }
 
 REPL::~REPL() = default;
 
+void REPL::SetCommandOptions(const CommandObjectExpressionOptions &options) {
+  m_command_options =
+      llvm::make_unique<CommandObjectExpressionOptions>(options);
+}
+
 lldb::REPLSP REPL::Create(Status &err, lldb::LanguageType language,
                           Debugger *debugger, Target *target,
                           const char *repl_options) {
@@ -278,18 +286,19 @@
 
       EvaluateExpressionOptions expr_options;
       expr_options.SetCoerceToId(m_varobj_options.use_objc);
-      expr_options.SetUnwindOnError(m_command_options.unwind_on_error);
-      expr_options.SetIgnoreBreakpoints(m_command_options.ignore_breakpoints);
+      expr_options.SetUnwindOnError(m_command_options->unwind_on_error);
+      expr_options.SetIgnoreBreakpoints(m_command_options->ignore_breakpoints);
       expr_options.SetKeepInMemory(true);
       expr_options.SetUseDynamic(m_varobj_options.use_dynamic);
-      expr_options.SetTryAllThreads(m_command_options.try_all_threads);
+      expr_options.SetTryAllThreads(m_command_options->try_all_threads);
       expr_options.SetGenerateDebugInfo(true);
       expr_options.SetREPLEnabled(true);
       expr_options.SetColorizeErrors(colorize_err);
       expr_options.SetPoundLine(m_repl_source_path.c_str(),
                                 m_code.GetSize() + 1);
-      if (m_command_options.timeout > 0)
-        expr_options.SetTimeout(std::chrono::microseconds(m_command_options.timeout));
+      if (m_command_options->timeout > 0)
+        expr_options.SetTimeout(
+            std::chrono::microseconds(m_command_options->timeout));
       else
         expr_options.SetTimeout(llvm::None);
 
Index: lldb/source/Commands/CommandObjectWatchpointCommand.cpp
===================================================================
--- lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -8,10 +8,10 @@
 
 #include <vector>
 
-#include "CommandObjectWatchpoint.h"
-#include "CommandObjectWatchpointCommand.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Breakpoint/Watchpoint.h"
+#include "lldb/Commands/CommandObjectWatchpoint.h"
+#include "lldb/Commands/CommandObjectWatchpointCommand.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
Index: lldb/source/Commands/CommandObjectWatchpoint.cpp
===================================================================
--- lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectWatchpoint.h"
-#include "CommandObjectWatchpointCommand.h"
+#include "lldb/Commands/CommandObjectWatchpoint.h"
+#include "lldb/Commands/CommandObjectWatchpointCommand.h"
 
 #include <vector>
 
Index: lldb/source/Commands/CommandObjectVersion.cpp
===================================================================
--- lldb/source/Commands/CommandObjectVersion.cpp
+++ lldb/source/Commands/CommandObjectVersion.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectVersion.h"
+#include "lldb/Commands/CommandObjectVersion.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
Index: lldb/source/Commands/CommandObjectType.cpp
===================================================================
--- lldb/source/Commands/CommandObjectType.cpp
+++ lldb/source/Commands/CommandObjectType.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectType.h"
+#include "lldb/Commands/CommandObjectType.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/IOHandler.h"
Index: lldb/source/Commands/CommandObjectThread.cpp
===================================================================
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectThread.h"
+#include "lldb/Commands/CommandObjectThread.h"
 
 #include "lldb/Core/SourceManager.h"
 #include "lldb/Core/ValueObject.h"
Index: lldb/source/Commands/CommandObjectTarget.cpp
===================================================================
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectTarget.h"
+#include "lldb/Commands/CommandObjectTarget.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/IOHandler.h"
Index: lldb/source/Commands/CommandObjectStats.cpp
===================================================================
--- lldb/source/Commands/CommandObjectStats.cpp
+++ lldb/source/Commands/CommandObjectStats.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectStats.h"
+#include "lldb/Commands/CommandObjectStats.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
Index: lldb/source/Commands/CommandObjectSource.cpp
===================================================================
--- lldb/source/Commands/CommandObjectSource.cpp
+++ lldb/source/Commands/CommandObjectSource.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectSource.h"
+#include "lldb/Commands/CommandObjectSource.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/FileLineResolver.h"
Index: lldb/source/Commands/CommandObjectSettings.cpp
===================================================================
--- lldb/source/Commands/CommandObjectSettings.cpp
+++ lldb/source/Commands/CommandObjectSettings.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectSettings.h"
+#include "lldb/Commands/CommandObjectSettings.h"
 
 #include "llvm/ADT/StringRef.h"
 
Index: lldb/source/Commands/CommandObjectReproducer.cpp
===================================================================
--- lldb/source/Commands/CommandObjectReproducer.cpp
+++ lldb/source/Commands/CommandObjectReproducer.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectReproducer.h"
+#include "lldb/Commands/CommandObjectReproducer.h"
 
 #include "lldb/Utility/Reproducer.h"
 
Index: lldb/source/Commands/CommandObjectRegister.cpp
===================================================================
--- lldb/source/Commands/CommandObjectRegister.cpp
+++ lldb/source/Commands/CommandObjectRegister.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectRegister.h"
+#include "lldb/Commands/CommandObjectRegister.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/DumpRegisterValue.h"
 #include "lldb/Host/OptionParser.h"
Index: lldb/source/Commands/CommandObjectQuit.cpp
===================================================================
--- lldb/source/Commands/CommandObjectQuit.cpp
+++ lldb/source/Commands/CommandObjectQuit.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectQuit.h"
+#include "lldb/Commands/CommandObjectQuit.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
Index: lldb/source/Commands/CommandObjectProcess.cpp
===================================================================
--- lldb/source/Commands/CommandObjectProcess.cpp
+++ lldb/source/Commands/CommandObjectProcess.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectProcess.h"
+#include "lldb/Commands/CommandObjectProcess.h"
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/BreakpointSite.h"
Index: lldb/source/Commands/CommandObjectPlugin.cpp
===================================================================
--- lldb/source/Commands/CommandObjectPlugin.cpp
+++ lldb/source/Commands/CommandObjectPlugin.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectPlugin.h"
+#include "lldb/Commands/CommandObjectPlugin.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
Index: lldb/source/Commands/CommandObjectPlatform.cpp
===================================================================
--- lldb/source/Commands/CommandObjectPlatform.cpp
+++ lldb/source/Commands/CommandObjectPlatform.cpp
@@ -6,8 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <mutex>
-#include "CommandObjectPlatform.h"
+#include "lldb/Commands/CommandObjectPlatform.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
@@ -23,6 +22,7 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/Args.h"
 #include "lldb/Utility/DataExtractor.h"
+#include <mutex>
 
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Threading.h"
Index: lldb/source/Commands/CommandObjectMemory.cpp
===================================================================
--- lldb/source/Commands/CommandObjectMemory.cpp
+++ lldb/source/Commands/CommandObjectMemory.cpp
@@ -8,8 +8,8 @@
 
 #include "clang/AST/Decl.h"
 
-#include "CommandObjectMemory.h"
 #include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
+#include "lldb/Commands/CommandObjectMemory.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/DumpDataExtractor.h"
 #include "lldb/Core/Module.h"
Index: lldb/source/Commands/CommandObjectLog.cpp
===================================================================
--- lldb/source/Commands/CommandObjectLog.cpp
+++ lldb/source/Commands/CommandObjectLog.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectLog.h"
+#include "lldb/Commands/CommandObjectLog.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/StreamFile.h"
Index: lldb/source/Commands/CommandObjectLanguage.cpp
===================================================================
--- lldb/source/Commands/CommandObjectLanguage.cpp
+++ lldb/source/Commands/CommandObjectLanguage.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectLanguage.h"
+#include "lldb/Commands/CommandObjectLanguage.h"
 
 #include "lldb/Host/Host.h"
 
Index: lldb/source/Commands/CommandObjectHelp.cpp
===================================================================
--- lldb/source/Commands/CommandObjectHelp.cpp
+++ lldb/source/Commands/CommandObjectHelp.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectHelp.h"
+#include "lldb/Commands/CommandObjectHelp.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
Index: lldb/source/Commands/CommandObjectGUI.cpp
===================================================================
--- lldb/source/Commands/CommandObjectGUI.cpp
+++ lldb/source/Commands/CommandObjectGUI.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectGUI.h"
+#include "lldb/Commands/CommandObjectGUI.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
Index: lldb/source/Commands/CommandObjectFrame.cpp
===================================================================
--- lldb/source/Commands/CommandObjectFrame.cpp
+++ lldb/source/Commands/CommandObjectFrame.cpp
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-#include "CommandObjectFrame.h"
+#include "lldb/Commands/CommandObjectFrame.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/StreamFile.h"
Index: lldb/source/Commands/CommandObjectExpression.cpp
===================================================================
--- lldb/source/Commands/CommandObjectExpression.cpp
+++ lldb/source/Commands/CommandObjectExpression.cpp
@@ -9,8 +9,8 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 
-#include "CommandObjectExpression.h"
 #include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h"
+#include "lldb/Commands/CommandObjectExpression.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObjectVariable.h"
@@ -34,9 +34,10 @@
 using namespace lldb;
 using namespace lldb_private;
 
-CommandObjectExpression::CommandOptions::CommandOptions() : OptionGroup() {}
+CommandObjectExpressionOptions::CommandObjectExpressionOptions()
+    : OptionGroup() {}
 
-CommandObjectExpression::CommandOptions::~CommandOptions() = default;
+CommandObjectExpressionOptions::~CommandObjectExpressionOptions() = default;
 
 static constexpr OptionEnumValueElement g_description_verbosity_type[] = {
     {eLanguageRuntimeDescriptionDisplayVerbosityCompact, "compact",
@@ -68,7 +69,7 @@
     // clang-format on
 };
 
-Status CommandObjectExpression::CommandOptions::SetOptionValue(
+Status CommandObjectExpressionOptions::SetOptionValue(
     uint32_t option_idx, llvm::StringRef option_arg,
     ExecutionContext *execution_context) {
   Status error;
@@ -185,7 +186,7 @@
   return error;
 }
 
-void CommandObjectExpression::CommandOptions::OptionParsingStarting(
+void CommandObjectExpressionOptions::OptionParsingStarting(
     ExecutionContext *execution_context) {
   auto process_sp =
       execution_context ? execution_context->GetProcessSP() : ProcessSP();
@@ -209,7 +210,7 @@
 }
 
 llvm::ArrayRef<OptionDefinition>
-CommandObjectExpression::CommandOptions::GetDefinitions() {
+CommandObjectExpressionOptions::GetDefinitions() {
   return llvm::makeArrayRef(g_expression_options);
 }
 
Index: lldb/source/Commands/CommandObjectDisassemble.cpp
===================================================================
--- lldb/source/Commands/CommandObjectDisassemble.cpp
+++ lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectDisassemble.h"
+#include "lldb/Commands/CommandObjectDisassemble.h"
 #include "lldb/Core/AddressRange.h"
 #include "lldb/Core/Disassembler.h"
 #include "lldb/Core/Module.h"
Index: lldb/source/Commands/CommandObjectCommands.cpp
===================================================================
--- lldb/source/Commands/CommandObjectCommands.cpp
+++ lldb/source/Commands/CommandObjectCommands.cpp
@@ -8,8 +8,8 @@
 
 #include "llvm/ADT/StringRef.h"
 
-#include "CommandObjectCommands.h"
-#include "CommandObjectHelp.h"
+#include "lldb/Commands/CommandObjectCommands.h"
+#include "lldb/Commands/CommandObjectHelp.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Host/OptionParser.h"
Index: lldb/source/Commands/CommandObjectBugreport.cpp
===================================================================
--- lldb/source/Commands/CommandObjectBugreport.cpp
+++ lldb/source/Commands/CommandObjectBugreport.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectBugreport.h"
+#include "lldb/Commands/CommandObjectBugreport.h"
 
 #include <cstdio>
 
Index: lldb/source/Commands/CommandObjectBreakpointCommand.cpp
===================================================================
--- lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -6,12 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectBreakpointCommand.h"
-#include "CommandObjectBreakpoint.h"
+#include "lldb/Commands/CommandObjectBreakpointCommand.h"
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointIDList.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Commands/CommandObjectBreakpoint.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
Index: lldb/source/Commands/CommandObjectBreakpoint.cpp
===================================================================
--- lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -6,11 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectBreakpoint.h"
-#include "CommandObjectBreakpointCommand.h"
+#include "lldb/Commands/CommandObjectBreakpoint.h"
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointIDList.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Commands/CommandObjectBreakpointCommand.h"
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
Index: lldb/source/Commands/CommandObjectApropos.cpp
===================================================================
--- lldb/source/Commands/CommandObjectApropos.cpp
+++ lldb/source/Commands/CommandObjectApropos.cpp
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CommandObjectApropos.h"
+#include "lldb/Commands/CommandObjectApropos.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/Options.h"
Index: lldb/source/API/SBTarget.cpp
===================================================================
--- lldb/source/API/SBTarget.cpp
+++ lldb/source/API/SBTarget.cpp
@@ -64,7 +64,7 @@
 #include "lldb/Utility/ProcessInfo.h"
 #include "lldb/Utility/RegularExpression.h"
 
-#include "Commands/CommandObjectBreakpoint.h"
+#include "lldb/Commands/CommandObjectBreakpoint.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Regex.h"
Index: lldb/include/lldb/Expression/REPL.h
===================================================================
--- lldb/include/lldb/Expression/REPL.h
+++ lldb/include/lldb/Expression/REPL.h
@@ -11,12 +11,12 @@
 
 #include <string>
 
-#include "lldb/../../source/Commands/CommandObjectExpression.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
 
 namespace lldb_private {
 
+class CommandObjectExpressionOptions;
 class REPL : public IOHandlerDelegate {
 public:
   //----------------------------------------------------------------------
@@ -68,10 +68,7 @@
     m_varobj_options = options;
   }
 
-  void
-  SetCommandOptions(const CommandObjectExpression::CommandOptions &options) {
-    m_command_options = options;
-  }
+  void SetCommandOptions(const CommandObjectExpressionOptions &options);
 
   void SetCompilerOptions(const char *options) {
     if (options)
@@ -145,7 +142,7 @@
 
   OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
   OptionGroupValueObjectDisplay m_varobj_options;
-  CommandObjectExpression::CommandOptions m_command_options;
+  std::unique_ptr<CommandObjectExpressionOptions> m_command_options;
   std::string m_compiler_options;
 
   bool m_enable_auto_indent = true;
Index: lldb/include/lldb/Commands/CommandObjectWatchpointCommand.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectWatchpointCommand.h
+++ lldb/include/lldb/Commands/CommandObjectWatchpointCommand.h
@@ -9,8 +9,6 @@
 #ifndef liblldb_CommandObjectWatchpointCommand_h_
 #define liblldb_CommandObjectWatchpointCommand_h_
 
-
-
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/lldb-types.h"
Index: lldb/include/lldb/Commands/CommandObjectWatchpoint.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectWatchpoint.h
+++ lldb/include/lldb/Commands/CommandObjectWatchpoint.h
@@ -9,7 +9,6 @@
 #ifndef liblldb_CommandObjectWatchpoint_h_
 #define liblldb_CommandObjectWatchpoint_h_
 
-
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/OptionGroupWatchpoint.h"
 #include "lldb/Interpreter/Options.h"
Index: lldb/include/lldb/Commands/CommandObjectType.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectType.h
+++ lldb/include/lldb/Commands/CommandObjectType.h
@@ -9,8 +9,6 @@
 #ifndef liblldb_CommandObjectType_h_
 #define liblldb_CommandObjectType_h_
 
-
-
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/lldb-types.h"
Index: lldb/include/lldb/Commands/CommandObjectPlugin.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectPlugin.h
+++ lldb/include/lldb/Commands/CommandObjectPlugin.h
@@ -9,8 +9,6 @@
 #ifndef liblldb_CommandObjectPlugin_h_
 #define liblldb_CommandObjectPlugin_h_
 
-
-
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/lldb-types.h"
 
Index: lldb/include/lldb/Commands/CommandObjectLanguage.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectLanguage.h
+++ lldb/include/lldb/Commands/CommandObjectLanguage.h
@@ -9,8 +9,6 @@
 #ifndef liblldb_CommandObjectLanguage_h_
 #define liblldb_CommandObjectLanguage_h_
 
-
-
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/lldb-types.h"
 
Index: lldb/include/lldb/Commands/CommandObjectExpression.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectExpression.h
+++ lldb/include/lldb/Commands/CommandObjectExpression.h
@@ -18,36 +18,36 @@
 #include "lldb/lldb-private-enumerations.h"
 namespace lldb_private {
 
-class CommandObjectExpression : public CommandObjectRaw,
-                                public IOHandlerDelegate {
+class CommandObjectExpressionOptions : public OptionGroup {
 public:
-  class CommandOptions : public OptionGroup {
-  public:
-    CommandOptions();
+  CommandObjectExpressionOptions();
 
-    ~CommandOptions() override;
+  ~CommandObjectExpressionOptions() override;
 
-    llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+  llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
 
-    Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
-                          ExecutionContext *execution_context) override;
+  Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+                        ExecutionContext *execution_context) override;
 
-    void OptionParsingStarting(ExecutionContext *execution_context) override;
+  void OptionParsingStarting(ExecutionContext *execution_context) override;
 
-    bool top_level;
-    bool unwind_on_error;
-    bool ignore_breakpoints;
-    bool allow_jit;
-    bool show_types;
-    bool show_summary;
-    bool debug;
-    uint32_t timeout;
-    bool try_all_threads;
-    lldb::LanguageType language;
-    LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
-    LazyBool auto_apply_fixits;
-  };
+  bool top_level;
+  bool unwind_on_error;
+  bool ignore_breakpoints;
+  bool allow_jit;
+  bool show_types;
+  bool show_summary;
+  bool debug;
+  uint32_t timeout;
+  bool try_all_threads;
+  lldb::LanguageType language;
+  LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
+  LazyBool auto_apply_fixits;
+};
 
+class CommandObjectExpression : public CommandObjectRaw,
+                                public IOHandlerDelegate {
+public:
   CommandObjectExpression(CommandInterpreter &interpreter);
 
   ~CommandObjectExpression() override;
@@ -78,12 +78,11 @@
   OptionGroupFormat m_format_options;
   OptionGroupValueObjectDisplay m_varobj_options;
   OptionGroupBoolean m_repl_option;
-  CommandOptions m_command_options;
+  CommandObjectExpressionOptions m_command_options;
   uint32_t m_expr_line_count;
   std::string m_expr_lines;       // Multi-line expression support
   std::string m_fixed_expression; // Holds the current expression's fixed text.
 };
-
 } // namespace lldb_private
 
 #endif // liblldb_CommandObjectExpression_h_
Index: lldb/include/lldb/Commands/CommandObjectBreakpointCommand.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectBreakpointCommand.h
+++ lldb/include/lldb/Commands/CommandObjectBreakpointCommand.h
@@ -9,8 +9,6 @@
 #ifndef liblldb_CommandObjectBreakpointCommand_h_
 #define liblldb_CommandObjectBreakpointCommand_h_
 
-
-
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
Index: lldb/include/lldb/Commands/CommandObjectBreakpoint.h
===================================================================
--- lldb/include/lldb/Commands/CommandObjectBreakpoint.h
+++ lldb/include/lldb/Commands/CommandObjectBreakpoint.h
@@ -9,17 +9,15 @@
 #ifndef liblldb_CommandObjectBreakpoint_h_
 #define liblldb_CommandObjectBreakpoint_h_
 
-
 #include <utility>
 #include <vector>
 
-#include "lldb/lldb-private.h"
 #include "lldb/Breakpoint/BreakpointName.h"
 #include "lldb/Core/Address.h"
 #include "lldb/Core/STLUtils.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/Options.h"
-
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
@@ -33,19 +31,17 @@
 
   ~CommandObjectMultiwordBreakpoint() override;
 
-  static void VerifyBreakpointOrLocationIDs(Args &args, Target *target,
-                                            CommandReturnObject &result,
-                                            BreakpointIDList *valid_ids,
-                                            BreakpointName::Permissions
-                                                 ::PermissionKinds purpose) {
+  static void VerifyBreakpointOrLocationIDs(
+      Args &args, Target *target, CommandReturnObject &result,
+      BreakpointIDList *valid_ids,
+      BreakpointName::Permissions ::PermissionKinds purpose) {
     VerifyIDs(args, target, true, result, valid_ids, purpose);
   }
 
-  static void VerifyBreakpointIDs(Args &args, Target *target,
-                                  CommandReturnObject &result,
-                                  BreakpointIDList *valid_ids,
-                                  BreakpointName::Permissions::PermissionKinds 
-                                      purpose) {
+  static void
+  VerifyBreakpointIDs(Args &args, Target *target, CommandReturnObject &result,
+                      BreakpointIDList *valid_ids,
+                      BreakpointName::Permissions::PermissionKinds purpose) {
     VerifyIDs(args, target, false, result, valid_ids, purpose);
   }
 
@@ -53,8 +49,7 @@
   static void VerifyIDs(Args &args, Target *target, bool allow_locations,
                         CommandReturnObject &result,
                         BreakpointIDList *valid_ids,
-                        BreakpointName::Permissions::PermissionKinds 
-                                      purpose);
+                        BreakpointName::Permissions::PermissionKinds purpose);
 };
 
 } // namespace lldb_private
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to