From 145d95c9647987a635c7598f3b888546c0445c72 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 17 Apr 2018 18:53:35 +0000 Subject: [PATCH] Move Args.cpp from Interpreter to Utility Summary: The Args class is used in plenty of places besides the command interpreter (e.g., anything requiring an argc+argv combo, such as when launching a process), so it needs to be in a lower layer. Now that the class has no external dependencies, it can be moved down to the Utility module. This removes the last (direct) dependency from the Host module to Interpreter, so I remove the Interpreter module from Host's dependency list. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D45480 llvm-svn: 330200 --- lldb/include/lldb/Interpreter/CommandAlias.h | 2 +- .../lldb/Interpreter/CommandInterpreter.h | 2 +- lldb/include/lldb/Interpreter/CommandObject.h | 2 +- lldb/include/lldb/Interpreter/Options.h | 2 +- lldb/include/lldb/Target/ProcessInfo.h | 2 +- .../lldb/{Interpreter => Utility}/Args.h | 23 ++++++++----------- lldb/source/API/SBDebugger.cpp | 2 +- lldb/source/API/SBPlatform.cpp | 2 +- lldb/source/API/SBProcess.cpp | 2 +- lldb/source/API/SBTarget.cpp | 2 +- lldb/source/Breakpoint/BreakpointIDList.cpp | 2 +- lldb/source/Commands/CommandCompletions.cpp | 2 +- lldb/source/Commands/CommandObjectApropos.cpp | 2 +- .../source/Commands/CommandObjectCommands.cpp | 2 +- lldb/source/Commands/CommandObjectFrame.cpp | 2 +- lldb/source/Commands/CommandObjectLog.cpp | 2 +- lldb/source/Commands/CommandObjectMemory.cpp | 2 +- .../source/Commands/CommandObjectPlatform.cpp | 2 +- lldb/source/Commands/CommandObjectProcess.cpp | 2 +- .../source/Commands/CommandObjectRegister.cpp | 2 +- lldb/source/Commands/CommandObjectTarget.cpp | 2 +- lldb/source/Core/RegisterValue.cpp | 2 +- lldb/source/Host/CMakeLists.txt | 1 - lldb/source/Host/macosx/HostInfoMacOSX.mm | 2 +- lldb/source/Interpreter/CMakeLists.txt | 1 - .../source/Interpreter/CommandInterpreter.cpp | 2 +- .../Interpreter/CommandObjectScript.cpp | 2 +- lldb/source/Interpreter/OptionValueArch.cpp | 2 +- lldb/source/Interpreter/OptionValueArgs.cpp | 2 +- lldb/source/Interpreter/OptionValueArray.cpp | 2 +- .../Interpreter/OptionValueDictionary.cpp | 2 +- .../Interpreter/OptionValueFileSpec.cpp | 2 +- .../Interpreter/OptionValueFileSpecLIst.cpp | 2 +- .../Interpreter/OptionValueLanguage.cpp | 2 +- .../Interpreter/OptionValuePathMappings.cpp | 2 +- .../Interpreter/OptionValueProperties.cpp | 2 +- lldb/source/Interpreter/OptionValueString.cpp | 2 +- .../RenderScriptRuntime.cpp | 2 +- .../RenderScriptScriptGroup.cpp | 2 +- ...PlatformiOSSimulatorCoreSimulatorSupport.h | 2 +- .../gdb-remote/GDBRemoteCommunication.h | 2 +- .../GDBRemoteCommunicationClient.cpp | 2 +- .../GDBRemoteCommunicationServerLLGS.cpp | 2 +- .../Process/gdb-remote/ProcessGDBRemote.cpp | 2 +- lldb/source/{Interpreter => Utility}/Args.cpp | 13 ++--------- lldb/source/Utility/CMakeLists.txt | 1 + .../tools/lldb-server/LLDBServerUtilities.cpp | 2 +- lldb/unittests/Interpreter/CMakeLists.txt | 1 - .../TestArgs.cpp => Utility/ArgsTest.cpp} | 6 +++-- lldb/unittests/Utility/CMakeLists.txt | 1 + .../lldb-server/tests/MessageObjects.cpp | 2 +- .../tools/lldb-server/tests/TestClient.cpp | 2 +- 52 files changed, 61 insertions(+), 74 deletions(-) rename lldb/include/lldb/{Interpreter => Utility}/Args.h (98%) rename lldb/source/{Interpreter => Utility}/Args.cpp (98%) rename lldb/unittests/{Interpreter/TestArgs.cpp => Utility/ArgsTest.cpp} (98%) diff --git a/lldb/include/lldb/Interpreter/CommandAlias.h b/lldb/include/lldb/Interpreter/CommandAlias.h index 4658a1e444f4..5804323990df 100644 --- a/lldb/include/lldb/Interpreter/CommandAlias.h +++ b/lldb/include/lldb/Interpreter/CommandAlias.h @@ -16,8 +16,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandObject.h" +#include "lldb/Utility/Args.h" #include "lldb/lldb-forward.h" namespace lldb_private { diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index 5e561f47946d..ff75aaa9bba0 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -19,11 +19,11 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Event.h" #include "lldb/Core/IOHandler.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandAlias.h" #include "lldb/Interpreter/CommandHistory.h" #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/ScriptInterpreter.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StringList.h" #include "lldb/lldb-forward.h" diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index c818843fea92..88059f92d26c 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -20,10 +20,10 @@ // Project includes #include "lldb/Utility/Flags.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/Options.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/StringList.h" #include "lldb/lldb-private.h" diff --git a/lldb/include/lldb/Interpreter/Options.h b/lldb/include/lldb/Interpreter/Options.h index 564270cf1b20..0fcd95294ffa 100644 --- a/lldb/include/lldb/Interpreter/Options.h +++ b/lldb/include/lldb/Interpreter/Options.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-private.h" diff --git a/lldb/include/lldb/Target/ProcessInfo.h b/lldb/include/lldb/Target/ProcessInfo.h index 984202b9c2d9..9b503444135a 100644 --- a/lldb/include/lldb/Target/ProcessInfo.h +++ b/lldb/include/lldb/Target/ProcessInfo.h @@ -11,8 +11,8 @@ #define liblldb_ProcessInfo_h_ // LLDB headers -#include "lldb/Interpreter/Args.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Environment.h" #include "lldb/Utility/FileSpec.h" diff --git a/lldb/include/lldb/Interpreter/Args.h b/lldb/include/lldb/Utility/Args.h similarity index 98% rename from lldb/include/lldb/Interpreter/Args.h rename to lldb/include/lldb/Utility/Args.h index 53d973376103..4d26016ba38a 100644 --- a/lldb/include/lldb/Interpreter/Args.h +++ b/lldb/include/lldb/Utility/Args.h @@ -7,27 +7,22 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Command_h_ -#define liblldb_Command_h_ +#ifndef LLDB_UTILITY_ARGS_H +#define LLDB_UTILITY_ARGS_H -// C Includes -// C++ Includes +#include "lldb/Utility/Environment.h" +#include "lldb/lldb-private-types.h" +#include "lldb/lldb-types.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" #include #include #include -// Other libraries and framework includes -#include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/StringRef.h" -// Project includes -#include "lldb/Utility/Environment.h" -#include "lldb/lldb-private-types.h" -#include "lldb/lldb-types.h" - namespace lldb_private { //---------------------------------------------------------------------- -/// @class Args Args.h "lldb/Interpreter/Args.h" +/// @class Args Args.h "lldb/Utility/Args.h" /// @brief A command line argument class. /// /// The Args class is designed to be fed a command line. The @@ -365,4 +360,4 @@ private: } // namespace lldb_private -#endif // liblldb_Command_h_ +#endif // LLDB_UTILITY_ARGS_H diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index c9909bb210de..97315d4c8fee 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -45,12 +45,12 @@ #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/Host/XML.h" #include "lldb/Initialization/SystemLifetimeManager.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupPlatform.h" #include "lldb/Target/Process.h" #include "lldb/Target/TargetList.h" +#include "lldb/Utility/Args.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp index ef06dd218346..8d2c40135824 100644 --- a/lldb/source/API/SBPlatform.cpp +++ b/lldb/source/API/SBPlatform.cpp @@ -13,10 +13,10 @@ #include "lldb/API/SBLaunchInfo.h" #include "lldb/API/SBUnixSignals.h" #include "lldb/Host/File.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Status.h" #include "llvm/Support/FileSystem.h" diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 6be9825624cf..23c1ede9983e 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -20,13 +20,13 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/State.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/SystemRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index e1cc6538bdf7..9e9396df0150 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -44,7 +44,6 @@ #include "lldb/Core/ValueObjectList.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Host/Host.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/DeclVendor.h" #include "lldb/Symbol/ObjectFile.h" @@ -60,6 +59,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/TargetList.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/RegularExpression.h" diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 6d610d512f3b..44748fafc1fd 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -16,9 +16,9 @@ #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Args.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 4f1f95522b02..49c79e98ea71 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -23,13 +23,13 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Host/FileSystem.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Variable.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/TildeExpressionResolver.h" diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp index 1114a511aa07..43a188998b48 100644 --- a/lldb/source/Commands/CommandObjectApropos.cpp +++ b/lldb/source/Commands/CommandObjectApropos.cpp @@ -13,11 +13,11 @@ // Other libraries and framework includes // Project includes #include "CommandObjectApropos.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/Property.h" +#include "lldb/Utility/Args.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 8aff1b6d2a63..500e217265c9 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -18,7 +18,6 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/IOHandler.h" #include "lldb/Host/OptionParser.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandHistory.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObjectRegexCommand.h" @@ -29,6 +28,7 @@ #include "lldb/Interpreter/OptionValueUInt64.h" #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/ScriptInterpreter.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/StringList.h" using namespace lldb; diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index b40cd090a5cd..d1ca460e04c1 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -24,7 +24,6 @@ #include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Host/Host.h" #include "lldb/Host/OptionParser.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionGroupFormat.h" @@ -44,6 +43,7 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index e3580c3ae0c3..8d6b1cd1854f 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -16,7 +16,6 @@ #include "lldb/Core/Module.h" #include "lldb/Core/StreamFile.h" #include "lldb/Host/OptionParser.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" @@ -27,6 +26,7 @@ #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/RegularExpression.h" diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 106b65dfb8a1..e882b7fdd7b1 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -24,7 +24,6 @@ #include "lldb/Core/ValueObjectMemory.h" #include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Host/OptionParser.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" @@ -41,6 +40,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/StreamString.h" diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 8ed003767d58..c3514288ce6b 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -18,7 +18,6 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Host/OptionParser.h" #include "lldb/Host/StringConvert.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandOptionValidators.h" #include "lldb/Interpreter/CommandReturnObject.h" @@ -27,6 +26,7 @@ #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/DataExtractor.h" #include "llvm/ADT/SmallString.h" diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index c2f5229c6741..da5110907f12 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -21,7 +21,6 @@ #include "lldb/Host/Host.h" #include "lldb/Host/OptionParser.h" #include "lldb/Host/StringConvert.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" @@ -32,6 +31,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/UnixSignals.h" +#include "lldb/Utility/Args.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index d535742016ac..5647142ea6fa 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -12,7 +12,6 @@ #include "lldb/Core/RegisterValue.h" #include "lldb/Core/Scalar.h" #include "lldb/Host/OptionParser.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionGroupFormat.h" @@ -25,6 +24,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/DataExtractor.h" #include "llvm/Support/Errno.h" diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 7520c510f7b4..69eeae137dad 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -21,7 +21,6 @@ #include "lldb/Host/OptionParser.h" #include "lldb/Host/StringConvert.h" #include "lldb/Host/Symbols.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" @@ -51,6 +50,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadSpec.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Timer.h" #include "llvm/Support/FileSystem.h" diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp index f64c14019cc6..9d422088a1b2 100644 --- a/lldb/source/Core/RegisterValue.cpp +++ b/lldb/source/Core/RegisterValue.cpp @@ -11,7 +11,7 @@ #include "lldb/Core/DumpDataExtractor.h" #include "lldb/Core/Scalar.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index 8aeb09314622..82d05bf639d7 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -180,7 +180,6 @@ add_lldb_library(lldbHost LINK_LIBS lldbCore - lldbInterpreter lldbSymbol lldbTarget lldbUtility diff --git a/lldb/source/Host/macosx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/HostInfoMacOSX.mm index 8774c76ef2da..bacf6fa50ef6 100644 --- a/lldb/source/Host/macosx/HostInfoMacOSX.mm +++ b/lldb/source/Host/macosx/HostInfoMacOSX.mm @@ -13,7 +13,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Host/macosx/HostInfoMacOSX.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/SafeMachO.h" diff --git a/lldb/source/Interpreter/CMakeLists.txt b/lldb/source/Interpreter/CMakeLists.txt index 4ae5dc5896dd..aaa335af39f9 100644 --- a/lldb/source/Interpreter/CMakeLists.txt +++ b/lldb/source/Interpreter/CMakeLists.txt @@ -1,5 +1,4 @@ add_lldb_library(lldbInterpreter - Args.cpp CommandAlias.cpp CommandHistory.cpp CommandInterpreter.cpp diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 6524aca549e1..ef56a4787fd7 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -54,13 +54,13 @@ #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/Property.h" +#include "lldb/Utility/Args.h" #include "lldb/Target/Process.h" #include "lldb/Target/TargetList.h" diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp index 0891298c5ac0..dfb1ba5037fd 100644 --- a/lldb/source/Interpreter/CommandObjectScript.cpp +++ b/lldb/source/Interpreter/CommandObjectScript.cpp @@ -18,10 +18,10 @@ #include "lldb/DataFormatters/DataVisualization.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/ScriptInterpreter.h" +#include "lldb/Utility/Args.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp index 1d920a114723..12b8e603992d 100644 --- a/lldb/source/Interpreter/OptionValueArch.cpp +++ b/lldb/source/Interpreter/OptionValueArch.cpp @@ -15,9 +15,9 @@ // Project includes #include "lldb/Core/State.h" #include "lldb/DataFormatters/FormatManager.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Utility/Args.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Interpreter/OptionValueArgs.cpp b/lldb/source/Interpreter/OptionValueArgs.cpp index 8edec77f9d2d..26e438548ea3 100644 --- a/lldb/source/Interpreter/OptionValueArgs.cpp +++ b/lldb/source/Interpreter/OptionValueArgs.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp index 8b62070352a6..d3fd1cb5db48 100644 --- a/lldb/source/Interpreter/OptionValueArray.cpp +++ b/lldb/source/Interpreter/OptionValueArray.cpp @@ -14,7 +14,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Host/StringConvert.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Stream.h" using namespace lldb; diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp index a57ede486319..76e4012858c2 100644 --- a/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -16,8 +16,8 @@ // Project includes #include "lldb/Core/State.h" #include "lldb/DataFormatters/FormatManager.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/OptionValueString.h" +#include "lldb/Utility/Args.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index 7d17ddec4f9c..9430015453bf 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -12,9 +12,9 @@ #include "lldb/Core/State.h" #include "lldb/DataFormatters/FormatManager.h" #include "lldb/Host/FileSystem.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/DataBufferLLVM.h" using namespace lldb; diff --git a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp index 7773bdc5ea9c..7fdc3c780239 100644 --- a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp @@ -14,7 +14,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Host/StringConvert.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Stream.h" using namespace lldb; diff --git a/lldb/source/Interpreter/OptionValueLanguage.cpp b/lldb/source/Interpreter/OptionValueLanguage.cpp index 3290e88c1815..1a82329bf0f3 100644 --- a/lldb/source/Interpreter/OptionValueLanguage.cpp +++ b/lldb/source/Interpreter/OptionValueLanguage.cpp @@ -14,8 +14,8 @@ // Other libraries and framework includes // Project includes #include "lldb/DataFormatters/FormatManager.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Target/Language.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Stream.h" using namespace lldb; diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp index 5f805720bd3f..8390a8cf5aba 100644 --- a/lldb/source/Interpreter/OptionValuePathMappings.cpp +++ b/lldb/source/Interpreter/OptionValuePathMappings.cpp @@ -14,7 +14,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Host/StringConvert.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Stream.h" diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index ae7669605592..a41a7a96ee8c 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -16,9 +16,9 @@ #include "lldb/Utility/Flags.h" #include "lldb/Core/UserSettingsController.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/OptionValues.h" #include "lldb/Interpreter/Property.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StringList.h" diff --git a/lldb/source/Interpreter/OptionValueString.cpp b/lldb/source/Interpreter/OptionValueString.cpp index 1d7332dd41a6..8383b531270b 100644 --- a/lldb/source/Interpreter/OptionValueString.cpp +++ b/lldb/source/Interpreter/OptionValueString.cpp @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Host/OptionParser.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Stream.h" using namespace lldb; diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index ad1083be0285..a9707fae0724 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -26,7 +26,6 @@ #include "lldb/Expression/UserExpression.h" #include "lldb/Host/OptionParser.h" #include "lldb/Host/StringConvert.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObjectMultiword.h" #include "lldb/Interpreter/CommandReturnObject.h" @@ -40,6 +39,7 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/Log.h" diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp index fe4ae21a0c39..7786d686ad6a 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp @@ -10,7 +10,6 @@ #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObjectMultiword.h" #include "lldb/Interpreter/CommandReturnObject.h" @@ -20,6 +19,7 @@ #include "lldb/Symbol/VariableList.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h index 31e11a60e419..083e2d6c5687 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.h @@ -24,8 +24,8 @@ typedef void *id; #endif // Project includes -#include "lldb/Interpreter/Args.h" #include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index 3fb03084b5ee..67796e4c61ef 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -24,7 +24,7 @@ #include "lldb/Core/Listener.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/Predicate.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/lldb-public.h" #include "lldb/Utility/StringExtractorGDBRemote.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 72a9175b7f43..48d22e92a5c1 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -22,11 +22,11 @@ #include "lldb/Core/State.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/XML.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/JSON.h" #include "lldb/Utility/LLDBAssert.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index b72fd4cd9dc6..555f8229e8e0 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -33,9 +33,9 @@ #include "lldb/Host/common/NativeProcessProtocol.h" #include "lldb/Host/common/NativeRegisterContext.h" #include "lldb/Host/common/NativeThreadProtocol.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Target/FileAction.h" #include "lldb/Target/MemoryRegionInfo.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/Endian.h" #include "lldb/Utility/JSON.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 0fb97b2f7db4..9d549ff491be 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -47,7 +47,6 @@ #include "lldb/Host/Symbols.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/XML.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/CommandObjectMultiword.h" @@ -66,6 +65,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/TargetList.h" #include "lldb/Target/ThreadPlanCallFunction.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/CleanUp.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/StreamString.h" diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Utility/Args.cpp similarity index 98% rename from lldb/source/Interpreter/Args.cpp rename to lldb/source/Utility/Args.cpp index 1fa7c9e41ab1..d9d7b35b935a 100644 --- a/lldb/source/Interpreter/Args.cpp +++ b/lldb/source/Utility/Args.cpp @@ -7,25 +7,16 @@ // //===----------------------------------------------------------------------===// -// C Includes -#include -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StringList.h" - -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" using namespace lldb; using namespace lldb_private; - // A helper function for argument parsing. // Parses the initial part of the first argument using normal double quote // rules: @@ -182,7 +173,7 @@ Args::Args(llvm::StringRef command) { SetCommandString(command); } Args::Args(const Args &rhs) { *this = rhs; } Args::Args(const StringList &list) : Args() { - for(size_t i = 0; i < list.GetSize(); ++i) + for (size_t i = 0; i < list.GetSize(); ++i) AppendArgument(list[i]); } diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt index 89ae324e56a9..881fa00f8de1 100644 --- a/lldb/source/Utility/CMakeLists.txt +++ b/lldb/source/Utility/CMakeLists.txt @@ -41,6 +41,7 @@ endif() add_lldb_library(lldbUtility ArchSpec.cpp + Args.cpp Baton.cpp Connection.cpp ConstString.cpp diff --git a/lldb/tools/lldb-server/LLDBServerUtilities.cpp b/lldb/tools/lldb-server/LLDBServerUtilities.cpp index e784a3a82684..7d41b3b4c745 100644 --- a/lldb/tools/lldb-server/LLDBServerUtilities.cpp +++ b/lldb/tools/lldb-server/LLDBServerUtilities.cpp @@ -10,7 +10,7 @@ #include "LLDBServerUtilities.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" diff --git a/lldb/unittests/Interpreter/CMakeLists.txt b/lldb/unittests/Interpreter/CMakeLists.txt index fc7f3b1220f6..b654ee12dc07 100644 --- a/lldb/unittests/Interpreter/CMakeLists.txt +++ b/lldb/unittests/Interpreter/CMakeLists.txt @@ -1,5 +1,4 @@ add_lldb_unittest(InterpreterTests - TestArgs.cpp TestCompletion.cpp TestOptionArgParser.cpp diff --git a/lldb/unittests/Interpreter/TestArgs.cpp b/lldb/unittests/Utility/ArgsTest.cpp similarity index 98% rename from lldb/unittests/Interpreter/TestArgs.cpp rename to lldb/unittests/Utility/ArgsTest.cpp index 092149fac5f4..586bbfdf128e 100644 --- a/lldb/unittests/Interpreter/TestArgs.cpp +++ b/lldb/unittests/Utility/ArgsTest.cpp @@ -9,7 +9,7 @@ #include "gtest/gtest.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/StringList.h" #include @@ -120,7 +120,9 @@ TEST(ArgsTest, TestArgv) { TEST(ArgsTest, StringListConstructor) { StringList list; - list << "foo" << "bar" << "baz"; + list << "foo" + << "bar" + << "baz"; Args args(list); ASSERT_EQ(3u, args.GetArgumentCount()); EXPECT_EQ("foo", args[0].ref); diff --git a/lldb/unittests/Utility/CMakeLists.txt b/lldb/unittests/Utility/CMakeLists.txt index e05084ab27a7..f4627b08fc1d 100644 --- a/lldb/unittests/Utility/CMakeLists.txt +++ b/lldb/unittests/Utility/CMakeLists.txt @@ -1,4 +1,5 @@ add_lldb_unittest(UtilityTests + ArgsTest.cpp ArchSpecTest.cpp CleanUpTest.cpp ConstStringTest.cpp diff --git a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp index fbcb0000da92..ef9be173ea66 100644 --- a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp +++ b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "MessageObjects.h" -#include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Args.h" #include "lldb/Utility/StringExtractor.h" #include "llvm/ADT/StringExtras.h" #include "gtest/gtest.h" diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp index 7bd94588b2ae..f6290c66e979 100644 --- a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -11,8 +11,8 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Host/common/TCPSocket.h" #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h" -#include "lldb/Interpreter/Args.h" #include "lldb/Target/ProcessLaunchInfo.h" +#include "lldb/Utility/Args.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Path.h" #include "llvm/Testing/Support/Error.h"