Index: include/lldb/Breakpoint/Breakpoint.h =================================================================== --- include/lldb/Breakpoint/Breakpoint.h +++ include/lldb/Breakpoint/Breakpoint.h @@ -26,7 +26,7 @@ #include "lldb/Breakpoint/Stoppoint.h" #include "lldb/Core/Event.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/StringList.h" namespace lldb_private { Index: include/lldb/Breakpoint/BreakpointOptions.h =================================================================== --- include/lldb/Breakpoint/BreakpointOptions.h +++ include/lldb/Breakpoint/BreakpointOptions.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/Baton.h" #include "lldb/Utility/StringList.h" #include "lldb/lldb-private.h" Index: include/lldb/Core/Event.h =================================================================== --- include/lldb/Core/Event.h +++ include/lldb/Core/Event.h @@ -11,7 +11,7 @@ #define liblldb_Event_h_ #include "lldb/Core/Broadcaster.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Host/Predicate.h" #include "lldb/Utility/ConstString.h" #include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN Index: include/lldb/Core/SearchFilter.h =================================================================== --- include/lldb/Core/SearchFilter.h +++ include/lldb/Core/SearchFilter.h @@ -11,7 +11,7 @@ #define liblldb_SearchFilter_h_ #include "lldb/Core/FileSpecList.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/FileSpec.h" // for FileSpec #include "lldb/lldb-forward.h" // for SearchFilterSP, TargetSP, Modu... Index: include/lldb/Core/StructuredDataImpl.h =================================================================== --- include/lldb/Core/StructuredDataImpl.h +++ include/lldb/Core/StructuredDataImpl.h @@ -11,10 +11,10 @@ #define liblldb_StructuredDataImpl_h_ #include "lldb/Core/Event.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Target/StructuredDataPlugin.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringRef.h" Index: include/lldb/Core/TraceOptions.h =================================================================== --- include/lldb/Core/TraceOptions.h +++ include/lldb/Core/TraceOptions.h @@ -13,7 +13,7 @@ #include "lldb/lldb-defines.h" #include "lldb/lldb-enumerations.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" namespace lldb_private { class TraceOptions { Index: include/lldb/DataFormatters/TypeSummary.h =================================================================== --- include/lldb/DataFormatters/TypeSummary.h +++ include/lldb/DataFormatters/TypeSummary.h @@ -24,7 +24,7 @@ #include "lldb/lldb-public.h" #include "lldb/Core/FormatEntity.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/Status.h" namespace lldb_private { Index: include/lldb/DataFormatters/TypeSynthetic.h =================================================================== --- include/lldb/DataFormatters/TypeSynthetic.h +++ include/lldb/DataFormatters/TypeSynthetic.h @@ -25,7 +25,7 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Core/ValueObject.h" namespace lldb_private { Index: include/lldb/Host/XML.h =================================================================== --- include/lldb/Host/XML.h +++ include/lldb/Host/XML.h @@ -24,7 +24,7 @@ #include "llvm/ADT/StringRef.h" // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-private.h" Index: include/lldb/Interpreter/ScriptInterpreter.h =================================================================== --- include/lldb/Interpreter/ScriptInterpreter.h +++ include/lldb/Interpreter/ScriptInterpreter.h @@ -19,7 +19,7 @@ #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/Status.h" #include "lldb/Host/PseudoTerminal.h" Index: include/lldb/Target/InstrumentationRuntime.h =================================================================== --- include/lldb/Target/InstrumentationRuntime.h +++ include/lldb/Target/InstrumentationRuntime.h @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" #include "lldb/lldb-types.h" Index: include/lldb/Target/InstrumentationRuntimeStopInfo.h =================================================================== --- include/lldb/Target/InstrumentationRuntimeStopInfo.h +++ include/lldb/Target/InstrumentationRuntimeStopInfo.h @@ -16,7 +16,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/StopInfo.h" namespace lldb_private { Index: include/lldb/Target/Process.h =================================================================== --- include/lldb/Target/Process.h +++ include/lldb/Target/Process.h @@ -34,7 +34,7 @@ #include "lldb/Core/Listener.h" #include "lldb/Core/LoadedModuleInfoList.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Core/ThreadSafeValue.h" #include "lldb/Core/TraceOptions.h" #include "lldb/Core/UserSettingsController.h" Index: include/lldb/Target/StopInfo.h =================================================================== --- include/lldb/Target/StopInfo.h +++ include/lldb/Target/StopInfo.h @@ -16,7 +16,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/Process.h" #include "lldb/lldb-public.h" Index: include/lldb/Target/StructuredDataPlugin.h =================================================================== --- include/lldb/Target/StructuredDataPlugin.h +++ include/lldb/Target/StructuredDataPlugin.h @@ -11,7 +11,7 @@ #define StructuredDataPlugin_h #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" namespace lldb_private { Index: include/lldb/Target/SystemRuntime.h =================================================================== --- include/lldb/Target/SystemRuntime.h +++ include/lldb/Target/SystemRuntime.h @@ -18,7 +18,7 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/QueueItem.h" #include "lldb/Target/QueueList.h" #include "lldb/Utility/ConstString.h" Index: include/lldb/Target/Thread.h =================================================================== --- include/lldb/Target/Thread.h +++ include/lldb/Target/Thread.h @@ -21,7 +21,7 @@ // Project includes #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Event.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/RegisterCheckpoint.h" Index: include/lldb/Target/ThreadPlanPython.h =================================================================== --- include/lldb/Target/ThreadPlanPython.h +++ include/lldb/Target/ThreadPlanPython.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" Index: include/lldb/Utility/JSON.h =================================================================== --- include/lldb/Utility/JSON.h +++ include/lldb/Utility/JSON.h @@ -269,7 +269,7 @@ EndOfFile }; - JSONParser(const char *cstr); + JSONParser(llvm::StringRef data); int GetEscapedChar(bool &was_escaped); Index: include/lldb/Utility/StructuredData.h =================================================================== --- include/lldb/Utility/StructuredData.h +++ include/lldb/Utility/StructuredData.h @@ -23,10 +23,9 @@ #include // for move #include #include - -#include // for assert -#include // for size_t -#include // for uint64_t +#include // for assert +#include // for size_t +#include // for uint64_t namespace lldb_private { class Status; @@ -38,7 +37,7 @@ namespace lldb_private { //---------------------------------------------------------------------- -/// @class StructuredData StructuredData.h "lldb/Core/StructuredData.h" +/// @class StructuredData StructuredData.h "lldb/Utility/StructuredData.h" /// @brief A class which can hold structured data /// /// The StructuredData class is designed to hold the data from a JSON Index: source/API/SBStructuredData.cpp =================================================================== --- source/API/SBStructuredData.cpp +++ source/API/SBStructuredData.cpp @@ -11,11 +11,11 @@ #include "lldb/API/SBStream.h" #include "lldb/Core/Event.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Core/StructuredDataImpl.h" #include "lldb/Target/StructuredDataPlugin.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" +#include "lldb/Utility/StructuredData.h" using namespace lldb; using namespace lldb_private; Index: source/API/SBThread.cpp =================================================================== --- source/API/SBThread.cpp +++ source/API/SBThread.cpp @@ -16,7 +16,6 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/State.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Core/ValueObject.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Symbol/CompileUnit.h" @@ -34,6 +33,7 @@ #include "lldb/Target/ThreadPlanStepRange.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/Stream.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/API/SBAddress.h" #include "lldb/API/SBDebugger.h" Index: source/API/SBThreadPlan.cpp =================================================================== --- source/API/SBThreadPlan.cpp +++ source/API/SBThreadPlan.cpp @@ -16,7 +16,6 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/State.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/SymbolContext.h" @@ -33,6 +32,7 @@ #include "lldb/Target/ThreadPlanStepOut.h" #include "lldb/Target/ThreadPlanStepRange.h" #include "lldb/Utility/Stream.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/API/SBAddress.h" #include "lldb/API/SBDebugger.h" Index: source/Core/CMakeLists.txt =================================================================== --- source/Core/CMakeLists.txt +++ source/Core/CMakeLists.txt @@ -33,7 +33,6 @@ State.cpp StreamAsynchronousIO.cpp StreamFile.cpp - StructuredData.cpp Timer.cpp UserSettingsController.cpp Value.cpp Index: source/Core/FormatEntity.cpp =================================================================== --- source/Core/FormatEntity.cpp +++ source/Core/FormatEntity.cpp @@ -15,7 +15,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" #include "lldb/Core/RegisterValue.h" // for RegisterValue -#include "lldb/Core/StructuredData.h" // for StructuredData::O... +#include "lldb/Utility/StructuredData.h" // for StructuredData::O... #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/DataFormatters/DataVisualization.h" Index: source/Host/macosx/Host.mm =================================================================== --- source/Host/macosx/Host.mm +++ source/Host/macosx/Host.mm @@ -59,7 +59,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/ThreadLauncher.h" Index: source/Host/windows/Host.cpp =================================================================== --- source/Host/windows/Host.cpp +++ source/Host/windows/Host.cpp @@ -20,11 +20,11 @@ #include "lldb/Utility/Status.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/StructuredData.h" #include "llvm/Support/ConvertUTF.h" Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" #include "lldb/Utility/FileSpec.h" Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h @@ -25,7 +25,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" #include "lldb/Utility/FileSpec.h" Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -28,7 +28,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" #include "lldb/Utility/FileSpec.h" Index: source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h =================================================================== --- source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h +++ source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/Target/Process.h" #include "lldb/lldb-private.h" Index: source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h =================================================================== --- source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h +++ source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h @@ -10,7 +10,7 @@ #ifndef liblldb_MainThreadCheckerRuntime_h_ #define liblldb_MainThreadCheckerRuntime_h_ -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/ABI.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/lldb-private.h" Index: source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h =================================================================== --- source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h +++ source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/ABI.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/lldb-private.h" Index: source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h =================================================================== --- source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h +++ source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h @@ -10,7 +10,7 @@ #ifndef liblldb_UndefinedBehaviorSanitizerRuntime_h_ #define liblldb_UndefinedBehaviorSanitizerRuntime_h_ -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/ABI.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/lldb-private.h" Index: source/Plugins/OperatingSystem/Python/OperatingSystemPython.h =================================================================== --- source/Plugins/OperatingSystem/Python/OperatingSystemPython.h +++ source/Plugins/OperatingSystem/Python/OperatingSystemPython.h @@ -16,7 +16,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/OperatingSystem.h" class DynamicRegisterInfo; Index: source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp =================================================================== --- source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -22,7 +22,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/RegisterValue.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/ScriptInterpreter.h" Index: source/Plugins/Process/POSIX/CMakeLists.txt =================================================================== --- source/Plugins/Process/POSIX/CMakeLists.txt +++ source/Plugins/Process/POSIX/CMakeLists.txt @@ -7,7 +7,6 @@ ProcessPOSIXLog.cpp LINK_LIBS - lldbCore lldbInterpreter LINK_COMPONENTS Support Index: source/Plugins/Process/Utility/DynamicRegisterInfo.h =================================================================== --- source/Plugins/Process/Utility/DynamicRegisterInfo.h +++ source/Plugins/Process/Utility/DynamicRegisterInfo.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" Index: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp =================================================================== --- source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -15,7 +15,7 @@ // Project includes #include "lldb/Core/ArchSpec.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/DataFormatters/FormatManager.h" #include "lldb/Host/StringConvert.h" #include "lldb/Utility/RegularExpression.h" Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -23,7 +23,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/Process.h" #include "lldb/Utility/StreamGDBRemote.h" Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -22,7 +22,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Threading.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Host/Config.h" #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/Host.h" Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h =================================================================== --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -24,7 +24,7 @@ #include "lldb/Core/Broadcaster.h" #include "lldb/Core/LoadedModuleInfoList.h" #include "lldb/Core/ModuleSpec.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Core/ThreadSafeValue.h" #include "lldb/Host/HostThread.h" #include "lldb/Target/Process.h" Index: source/Plugins/Process/gdb-remote/ThreadGDBRemote.h =================================================================== --- source/Plugins/Process/gdb-remote/ThreadGDBRemote.h +++ source/Plugins/Process/gdb-remote/ThreadGDBRemote.h @@ -16,7 +16,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h =================================================================== --- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -21,7 +21,7 @@ // Project includes #include "lldb/Utility/Flags.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Host/File.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Utility/ConstString.h" Index: source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h =================================================================== --- source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h +++ source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h @@ -19,7 +19,7 @@ // Other libraries and framework include // Project includes #include "lldb/Core/ModuleList.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/Process.h" #include "lldb/Target/QueueItem.h" #include "lldb/Target/SystemRuntime.h" Index: source/Target/Platform.cpp =================================================================== --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -25,7 +25,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" Index: source/Target/ThreadSpec.cpp =================================================================== --- source/Target/ThreadSpec.cpp +++ source/Target/ThreadSpec.cpp @@ -12,7 +12,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Target/Thread.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Target/ThreadSpec.h" using namespace lldb; Index: source/Utility/CMakeLists.txt =================================================================== --- source/Utility/CMakeLists.txt +++ source/Utility/CMakeLists.txt @@ -26,6 +26,7 @@ StringExtractorGDBRemote.cpp StringLexer.cpp StringList.cpp + StructuredData.cpp TaskPool.cpp TildeExpressionResolver.cpp UserID.cpp Index: source/Utility/JSON.cpp =================================================================== --- source/Utility/JSON.cpp +++ source/Utility/JSON.cpp @@ -191,7 +191,7 @@ JSONArray::Size JSONArray::GetNumElements() { return m_elements.size(); } -JSONParser::JSONParser(const char *cstr) : StringExtractor(cstr) {} +JSONParser::JSONParser(llvm::StringRef data) : StringExtractor(data) {} JSONParser::Token JSONParser::GetToken(std::string &value) { StreamString error; Index: source/Utility/StructuredData.cpp =================================================================== --- source/Utility/StructuredData.cpp +++ source/Utility/StructuredData.cpp @@ -7,28 +7,18 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Core/StructuredData.h" - -#include "lldb/Host/File.h" -#include "lldb/Host/StringConvert.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/JSON.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" // for Stream #include "lldb/Utility/StreamString.h" -#include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermiss... -#include "lldb/lldb-forward.h" // for DataBufferSP - #include "llvm/ADT/STLExtras.h" // for make_unique - #include // for numeric_limits - -#include +#include #include -#include // for printf -#include -#include // for off_t +#include using namespace lldb_private; @@ -43,36 +33,19 @@ StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Status &error) { StructuredData::ObjectSP return_sp; if (!input_spec.Exists()) { - error.SetErrorStringWithFormat("input file %s does not exist.", - input_spec.GetPath().c_str()); + error.SetErrorStringWithFormatv("input file {0} does not exist.", + input_spec); return return_sp; } - File input_file(nullptr, File::OpenOptions::eOpenOptionRead, - lldb::eFilePermissionsUserRead); - std::string input_path = input_spec.GetPath(); - error = - input_file.Open(input_path.c_str(), File::OpenOptions::eOpenOptionRead, - lldb::eFilePermissionsUserRead); - - if (!error.Success()) { - error.SetErrorStringWithFormat("could not open input file: %s - %s.", - input_spec.GetPath().c_str(), - error.AsCString()); + auto buffer_or_error = llvm::MemoryBuffer::getFile(input_spec.GetPath()); + if (!buffer_or_error) { + error.SetErrorStringWithFormatv("could not open input file: {0} - {1}.", + input_spec.GetPath(), buffer_or_error.getError().message()); return return_sp; } - lldb::DataBufferSP input_data; - size_t num_bytes = std::numeric_limits::max(); - off_t offset = 0; - error = input_file.Read(num_bytes, offset, true, input_data); - if (!error.Success()) { - error.SetErrorStringWithFormat("could not read input file: %s - %s.", - input_spec.GetPath().c_str(), - error.AsCString()); - return return_sp; - } - JSONParser json_parser((char *)input_data->GetBytes()); + JSONParser json_parser(buffer_or_error.get()->getBuffer()); return_sp = ParseJSONValue(json_parser); return return_sp; } @@ -146,16 +119,14 @@ return ParseJSONArray(json_parser); case JSONParser::Token::Integer: { - bool success = false; - uint64_t uval = StringConvert::ToUInt64(value.c_str(), 0, 0, &success); - if (success) + uint64_t uval; + if (llvm::to_integer(value, uval, 0)) return std::make_shared(uval); } break; case JSONParser::Token::Float: { - bool success = false; - double val = StringConvert::ToDouble(value.c_str(), 0.0, &success); - if (success) + double val; + if(llvm::to_float(value, val)) return std::make_shared(val); } break; @@ -219,7 +190,7 @@ void StructuredData::Object::DumpToStdout(bool pretty_print) const { StreamString stream; Dump(stream, pretty_print); - printf("%s\n", stream.GetData()); + llvm::outs() << stream.GetString(); } void StructuredData::Array::Dump(Stream &s, bool pretty_print) const { Index: unittests/Core/CMakeLists.txt =================================================================== --- unittests/Core/CMakeLists.txt +++ unittests/Core/CMakeLists.txt @@ -6,7 +6,6 @@ ScalarTest.cpp StateTest.cpp StreamCallbackTest.cpp - StructuredDataTest.cpp TimerTest.cpp LINK_LIBS Index: unittests/Core/StructuredDataTest.cpp =================================================================== --- unittests/Core/StructuredDataTest.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===-- StructuredDataTest.cpp ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "gtest/gtest.h" - -#include "lldb/Core/StructuredData.h" -#include "lldb/Utility/StreamString.h" - -#include "llvm/BinaryFormat/MachO.h" - -using namespace lldb; -using namespace lldb_private; - -TEST(StructuredDataTest, StringDump) { - std::pair TestCases[] = { - { R"(asdfg)", R"("asdfg")" }, - { R"(as"df)", R"("as\"df")" }, - { R"(as\df)", R"("as\\df")" }, - }; - for(auto P : TestCases) { - StreamString S; - const bool pretty_print = false; - StructuredData::String(P.first).Dump(S, pretty_print); - EXPECT_EQ(P.second, S.GetString()); - } -} Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp =================================================================== --- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -12,7 +12,7 @@ #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h" #include "lldb/Core/ModuleSpec.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Core/TraceOptions.h" #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Utility/DataBuffer.h" Index: unittests/Utility/CMakeLists.txt =================================================================== --- unittests/Utility/CMakeLists.txt +++ unittests/Utility/CMakeLists.txt @@ -6,6 +6,7 @@ NameMatchesTest.cpp StatusTest.cpp StringExtractorTest.cpp + StructuredDataTest.cpp TaskPoolTest.cpp TildeExpressionResolverTest.cpp TimeoutTest.cpp @@ -18,3 +19,7 @@ LINK_COMPONENTS Support ) + +add_unittest_inputs(UtilityTests + StructuredData-basic.json + ) Index: unittests/Utility/Inputs/StructuredData-basic.json =================================================================== --- /dev/null +++ unittests/Utility/Inputs/StructuredData-basic.json @@ -0,0 +1 @@ +[1, 2, 3] Index: unittests/Utility/StructuredDataTest.cpp =================================================================== --- /dev/null +++ unittests/Utility/StructuredDataTest.cpp @@ -0,0 +1,68 @@ +//===-- StructuredDataTest.cpp ----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" + +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/Utility/StructuredData.h" +#include "llvm/Support/Path.h" + +extern const char *TestMainArgv0; + +using namespace lldb; +using namespace lldb_private; + +namespace { + +class StructuredDataTest : public testing::Test { +public: + static void SetUpTestCase() { + s_inputs_folder = llvm::sys::path::parent_path(TestMainArgv0); + llvm::sys::path::append(s_inputs_folder, "Inputs"); + } + +protected: + static llvm::SmallString<128> s_inputs_folder; +}; +} + +llvm::SmallString<128> StructuredDataTest::s_inputs_folder; + +TEST_F(StructuredDataTest, StringDump) { + std::pair TestCases[] = { + { R"(asdfg)", R"("asdfg")" }, + { R"(as"df)", R"("as\"df")" }, + { R"(as\df)", R"("as\\df")" }, + }; + for(auto P : TestCases) { + StreamString S; + const bool pretty_print = false; + StructuredData::String(P.first).Dump(S, pretty_print); + EXPECT_EQ(P.second, S.GetString()); + } +} + +TEST_F(StructuredDataTest, ParseJSONFromFile) { + Status status; + auto object_sp = StructuredData::ParseJSONFromFile( + FileSpec("non-existing-file.json", false), status); + EXPECT_EQ(nullptr, object_sp); + + llvm::SmallString<128> input = s_inputs_folder; + llvm::sys::path::append(input, "StructuredData-basic.json"); + object_sp = StructuredData::ParseJSONFromFile(FileSpec(input, false), status); + ASSERT_NE(nullptr, object_sp); + + StreamString S; + object_sp->Dump(S, false); + EXPECT_EQ("[1,2,3]", S.GetString()); + + +} Index: unittests/tools/lldb-server/tests/MessageObjects.cpp =================================================================== --- unittests/tools/lldb-server/tests/MessageObjects.cpp +++ unittests/tools/lldb-server/tests/MessageObjects.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "MessageObjects.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "llvm/ADT/StringExtras.h" #include "gtest/gtest.h"