[lldb] Add support for negative integer to {SB,}StructuredData
authorMed Ismail Bennani <ismail@bennani.ma>
Mon, 22 May 2023 20:52:09 +0000 (13:52 -0700)
committerMed Ismail Bennani <ismail@bennani.ma>
Mon, 22 May 2023 23:14:00 +0000 (16:14 -0700)
commit1370a1cb5b97ecfc4fd2cb550159db9c9ebd3a68
treea281d98fa2d451a04b2b657c02ee19a98c674e3c
parent01c5ec3d6209875de05de94cd7923c4e462c3317
[lldb] Add support for negative integer to {SB,}StructuredData

This patch refactors the `StructuredData::Integer` class to make it
templated, makes it private and adds 2 public specialization for both
`int64_t` & `uint64_t` with a public type aliases, respectively
`SignedInteger` & `UnsignedInteger`.

It adds new getter for signed and unsigned interger values to the
`StructuredData::Object` base class and changes the implementation of
`StructuredData::Array::GetItemAtIndexAsInteger` and
`StructuredData::Dictionary::GetValueForKeyAsInteger` to support signed
and unsigned integers.

This patch also adds 2 new `Get{Signed,Unsigned}IntegerValue` to the
`SBStructuredData` class and marks `GetIntegerValue` as deprecated.

Finally, this patch audits all the caller of `StructuredData::Integer`
or `StructuredData::GetIntegerValue` to use the proper type as well the
various tests that uses `SBStructuredData.GetIntegerValue`.

rdar://105575764

Differential Revision: https://reviews.llvm.org/D150485

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
37 files changed:
lldb/include/lldb/API/SBStructuredData.h
lldb/include/lldb/Core/StructuredDataImpl.h
lldb/include/lldb/Utility/StructuredData.h
lldb/include/lldb/lldb-enumerations.h
lldb/source/API/SBStructuredData.cpp
lldb/source/API/SBThread.cpp
lldb/source/Breakpoint/BreakpointOptions.cpp
lldb/source/Breakpoint/BreakpointResolver.cpp
lldb/source/Breakpoint/BreakpointResolverAddress.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Host/common/XML.cpp
lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
lldb/source/Target/DynamicRegisterInfo.cpp
lldb/source/Target/Thread.cpp
lldb/source/Utility/StructuredData.cpp
lldb/test/API/commands/target/stop-hooks/stop_hook.py
lldb/test/API/functionalities/step_scripted/Steps.py
lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
lldb/tools/lldb-vscode/JSONUtils.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp