https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/137375
Completes the ToJSON for `OptionValueArch` and `OptionValueFileColumnLine` and make the interface function pure virtual >From a87d7be70ce0d82b159c163b1b319a349cb162ea Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <yerimy...@gmail.com> Date: Fri, 25 Apr 2025 18:20:24 +0100 Subject: [PATCH 1/3] [lldb] Add ToJson for OptionValueArch --- lldb/include/lldb/Interpreter/OptionValueArch.h | 2 ++ lldb/source/Interpreter/OptionValueArch.cpp | 8 ++++++++ lldb/test/API/commands/settings/TestSettings.py | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/lldb/include/lldb/Interpreter/OptionValueArch.h b/lldb/include/lldb/Interpreter/OptionValueArch.h index e175208794474..7e7b7657d7963 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArch.h +++ b/lldb/include/lldb/Interpreter/OptionValueArch.h @@ -38,6 +38,8 @@ class OptionValueArch : public Cloneable<OptionValueArch, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp index a2fed7737fc3e..72d8769c565a4 100644 --- a/lldb/source/Interpreter/OptionValueArch.cpp +++ b/lldb/source/Interpreter/OptionValueArch.cpp @@ -33,6 +33,14 @@ void OptionValueArch::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } +llvm::json::Value OptionValueArch::ToJSON(const ExecutionContext *exe_ctx) { + if (m_current_value.IsValid()) { + return llvm::json::Value(m_current_value.GetArchitectureName()); + } + + return {}; +} + Status OptionValueArch::SetValueFromString(llvm::StringRef value, VarSetOperationType op) { Status error; diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py index f05a285b47d16..4eb868430b006 100644 --- a/lldb/test/API/commands/settings/TestSettings.py +++ b/lldb/test/API/commands/settings/TestSettings.py @@ -1044,6 +1044,10 @@ def test_settings_api(self): # Test OptionValueEnumeration self.verify_setting_value_json("target.x86-disassembly-flavor", "intel") + # Test OptionValueArch + self.verify_setting_value_json("target.default-arch", "x86_64") + self.runCmd("settings clear target.default-arch") + def test_global_option(self): # This command used to crash the settings because -g was signaled by a # NULL execution context (not one with an empty Target...) and in the >From 5d9b7e4d6e9d080d1b0c84e849d491da76dc86da Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <yerimy...@gmail.com> Date: Fri, 25 Apr 2025 18:20:47 +0100 Subject: [PATCH 2/3] [lldb] Add ToJson for OptionValueFileColonLine --- .../lldb/Interpreter/OptionValueFileColonLine.h | 2 ++ .../source/Interpreter/OptionValueFileColonLine.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h index 181ef18bbcdf1..efe8a641e22f2 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h @@ -29,6 +29,8 @@ class OptionValueFileColonLine : void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; diff --git a/lldb/source/Interpreter/OptionValueFileColonLine.cpp b/lldb/source/Interpreter/OptionValueFileColonLine.cpp index 87d390d1b5ef4..312ee7f705e42 100644 --- a/lldb/source/Interpreter/OptionValueFileColonLine.cpp +++ b/lldb/source/Interpreter/OptionValueFileColonLine.cpp @@ -46,6 +46,19 @@ void OptionValueFileColonLine::DumpValue(const ExecutionContext *exe_ctx, } } +llvm::json::Value +OptionValueFileColonLine::ToJSON(const ExecutionContext *exe_ctx) { + StreamString stream; + if (m_file_spec) + stream << '"' << m_file_spec.GetPath().c_str() << '"'; + if (m_line_number != LLDB_INVALID_LINE_NUMBER) + stream.Printf(":%d", m_line_number); + if (m_column_number != LLDB_INVALID_COLUMN_NUMBER) + stream.Printf(":%d", m_column_number); + + return llvm::json::Value(stream.GetString()); +} + Status OptionValueFileColonLine::SetValueFromString(llvm::StringRef value, VarSetOperationType op) { Status error; >From 20d5251d6bbb12fbe48dae8e8a8ce93f9d85cccd Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <yerimy...@gmail.com> Date: Fri, 25 Apr 2025 18:25:31 +0100 Subject: [PATCH 3/3] [lldb] Make OptionValue::ToJSON abstract --- lldb/include/lldb/Interpreter/OptionValue.h | 10 +--------- lldb/include/lldb/Interpreter/OptionValueArch.h | 2 +- lldb/include/lldb/Interpreter/OptionValueArray.h | 2 +- lldb/include/lldb/Interpreter/OptionValueBoolean.h | 2 +- lldb/include/lldb/Interpreter/OptionValueChar.h | 2 +- lldb/include/lldb/Interpreter/OptionValueDictionary.h | 2 +- lldb/include/lldb/Interpreter/OptionValueEnumeration.h | 2 +- .../lldb/Interpreter/OptionValueFileColonLine.h | 2 +- lldb/include/lldb/Interpreter/OptionValueFileSpec.h | 2 +- .../include/lldb/Interpreter/OptionValueFileSpecList.h | 2 +- lldb/include/lldb/Interpreter/OptionValueFormat.h | 2 +- .../include/lldb/Interpreter/OptionValueFormatEntity.h | 2 +- lldb/include/lldb/Interpreter/OptionValueLanguage.h | 2 +- .../include/lldb/Interpreter/OptionValuePathMappings.h | 2 +- lldb/include/lldb/Interpreter/OptionValueProperties.h | 2 +- lldb/include/lldb/Interpreter/OptionValueRegex.h | 2 +- lldb/include/lldb/Interpreter/OptionValueSInt64.h | 2 +- lldb/include/lldb/Interpreter/OptionValueString.h | 2 +- lldb/include/lldb/Interpreter/OptionValueUInt64.h | 2 +- lldb/include/lldb/Interpreter/OptionValueUUID.h | 2 +- lldb/include/lldb/Target/PathMappingList.h | 2 +- lldb/source/Interpreter/OptionValueArch.cpp | 3 ++- lldb/source/Interpreter/OptionValueArray.cpp | 3 ++- lldb/source/Interpreter/OptionValueDictionary.cpp | 2 +- lldb/source/Interpreter/OptionValueEnumeration.cpp | 2 +- lldb/source/Interpreter/OptionValueFileColonLine.cpp | 2 +- lldb/source/Interpreter/OptionValueFileSpecList.cpp | 2 +- lldb/source/Interpreter/OptionValueFormat.cpp | 3 ++- lldb/source/Interpreter/OptionValueFormatEntity.cpp | 2 +- lldb/source/Interpreter/OptionValueLanguage.cpp | 3 ++- lldb/source/Interpreter/OptionValuePathMappings.cpp | 2 +- lldb/source/Interpreter/OptionValueProperties.cpp | 2 +- lldb/source/Target/PathMappingList.cpp | 2 +- 33 files changed, 37 insertions(+), 41 deletions(-) diff --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h index ebc438517a7b1..e3c139155b0ef 100644 --- a/lldb/include/lldb/Interpreter/OptionValue.h +++ b/lldb/include/lldb/Interpreter/OptionValue.h @@ -93,15 +93,7 @@ class OptionValue { virtual void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0; - // TODO: make this function pure virtual after implementing it in all - // child classes. - virtual llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) { - // Return nullptr which will create a llvm::json::Value() that is a NULL - // value. No setting should ever really have a NULL value in JSON. This - // indicates an error occurred and if/when we add a FromJSON() it will know - // to fail if someone tries to set it with a NULL JSON value. - return nullptr; - } + virtual llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const = 0; virtual Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueArch.h b/lldb/include/lldb/Interpreter/OptionValueArch.h index 7e7b7657d7963..3ba07b65dd618 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArch.h +++ b/lldb/include/lldb/Interpreter/OptionValueArch.h @@ -38,7 +38,7 @@ class OptionValueArch : public Cloneable<OptionValueArch, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueArray.h b/lldb/include/lldb/Interpreter/OptionValueArray.h index 0e1bae103d41f..34170ef06a188 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArray.h +++ b/lldb/include/lldb/Interpreter/OptionValueArray.h @@ -29,7 +29,7 @@ class OptionValueArray : public Cloneable<OptionValueArray, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h b/lldb/include/lldb/Interpreter/OptionValueBoolean.h index 01e7c6c09d8e8..6d15dcd2fca5d 100644 --- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h +++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h @@ -29,7 +29,7 @@ class OptionValueBoolean : public Cloneable<OptionValueBoolean, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_current_value; } diff --git a/lldb/include/lldb/Interpreter/OptionValueChar.h b/lldb/include/lldb/Interpreter/OptionValueChar.h index 32ec2bb59fc55..2e2cf1ac1e08d 100644 --- a/lldb/include/lldb/Interpreter/OptionValueChar.h +++ b/lldb/include/lldb/Interpreter/OptionValueChar.h @@ -30,7 +30,7 @@ class OptionValueChar : public Cloneable<OptionValueChar, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_current_value; } diff --git a/lldb/include/lldb/Interpreter/OptionValueDictionary.h b/lldb/include/lldb/Interpreter/OptionValueDictionary.h index 18ef448237157..800b7fc687640 100644 --- a/lldb/include/lldb/Interpreter/OptionValueDictionary.h +++ b/lldb/include/lldb/Interpreter/OptionValueDictionary.h @@ -34,7 +34,7 @@ class OptionValueDictionary void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h index 924fcc10cbb00..a3a13ca7b15eb 100644 --- a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h @@ -41,7 +41,7 @@ class OptionValueEnumeration void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h index efe8a641e22f2..70f035da649e7 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h @@ -29,7 +29,7 @@ class OptionValueFileColonLine : void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h index 52349bf36262f..66c5e328180f5 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h @@ -35,7 +35,7 @@ class OptionValueFileSpec : public Cloneable<OptionValueFileSpec, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_current_value.GetPath(); } diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h index 200ce701cb922..6250b5ee6fcb2 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h @@ -33,7 +33,7 @@ class OptionValueFileSpecList void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueFormat.h b/lldb/include/lldb/Interpreter/OptionValueFormat.h index 5be885fe4f70d..5fd3192304573 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormat.h +++ b/lldb/include/lldb/Interpreter/OptionValueFormat.h @@ -31,7 +31,7 @@ class OptionValueFormat void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h b/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h index b8ef03a44d033..0718e37625d71 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h +++ b/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -28,7 +28,7 @@ class OptionValueFormatEntity void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueLanguage.h b/lldb/include/lldb/Interpreter/OptionValueLanguage.h index f20a2c64f698d..e1c1f85493ad6 100644 --- a/lldb/include/lldb/Interpreter/OptionValueLanguage.h +++ b/lldb/include/lldb/Interpreter/OptionValueLanguage.h @@ -33,7 +33,7 @@ class OptionValueLanguage : public Cloneable<OptionValueLanguage, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValuePathMappings.h b/lldb/include/lldb/Interpreter/OptionValuePathMappings.h index 82a968a77c12e..e0aac2fd44484 100644 --- a/lldb/include/lldb/Interpreter/OptionValuePathMappings.h +++ b/lldb/include/lldb/Interpreter/OptionValuePathMappings.h @@ -29,7 +29,7 @@ class OptionValuePathMappings void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; Status SetValueFromString(llvm::StringRef value, diff --git a/lldb/include/lldb/Interpreter/OptionValueProperties.h b/lldb/include/lldb/Interpreter/OptionValueProperties.h index 2ee13c63c38c1..91a3955962372 100644 --- a/lldb/include/lldb/Interpreter/OptionValueProperties.h +++ b/lldb/include/lldb/Interpreter/OptionValueProperties.h @@ -46,7 +46,7 @@ class OptionValueProperties void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override; llvm::StringRef GetName() const override { return m_name; } diff --git a/lldb/include/lldb/Interpreter/OptionValueRegex.h b/lldb/include/lldb/Interpreter/OptionValueRegex.h index 3c188003ceb23..b952cb2476012 100644 --- a/lldb/include/lldb/Interpreter/OptionValueRegex.h +++ b/lldb/include/lldb/Interpreter/OptionValueRegex.h @@ -28,7 +28,7 @@ class OptionValueRegex : public Cloneable<OptionValueRegex, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_regex.GetText(); } diff --git a/lldb/include/lldb/Interpreter/OptionValueSInt64.h b/lldb/include/lldb/Interpreter/OptionValueSInt64.h index f7e72684e4102..c220ac29e461f 100644 --- a/lldb/include/lldb/Interpreter/OptionValueSInt64.h +++ b/lldb/include/lldb/Interpreter/OptionValueSInt64.h @@ -35,7 +35,7 @@ class OptionValueSInt64 : public Cloneable<OptionValueSInt64, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_current_value; } diff --git a/lldb/include/lldb/Interpreter/OptionValueString.h b/lldb/include/lldb/Interpreter/OptionValueString.h index becf35f8e88ef..4ec98176b6f8b 100644 --- a/lldb/include/lldb/Interpreter/OptionValueString.h +++ b/lldb/include/lldb/Interpreter/OptionValueString.h @@ -69,7 +69,7 @@ class OptionValueString : public Cloneable<OptionValueString, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_current_value; } diff --git a/lldb/include/lldb/Interpreter/OptionValueUInt64.h b/lldb/include/lldb/Interpreter/OptionValueUInt64.h index 5cccff177cb1d..087c1d3ee321a 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUInt64.h +++ b/lldb/include/lldb/Interpreter/OptionValueUInt64.h @@ -38,7 +38,7 @@ class OptionValueUInt64 : public Cloneable<OptionValueUInt64, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_current_value; } diff --git a/lldb/include/lldb/Interpreter/OptionValueUUID.h b/lldb/include/lldb/Interpreter/OptionValueUUID.h index e0e4235fdf076..2b7d9e41bcf77 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUUID.h +++ b/lldb/include/lldb/Interpreter/OptionValueUUID.h @@ -29,7 +29,7 @@ class OptionValueUUID : public Cloneable<OptionValueUUID, OptionValue> { void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override { + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override { return m_uuid.GetAsString(); } diff --git a/lldb/include/lldb/Target/PathMappingList.h b/lldb/include/lldb/Target/PathMappingList.h index 825278cf9afbc..2cf9569358f52 100644 --- a/lldb/include/lldb/Target/PathMappingList.h +++ b/lldb/include/lldb/Target/PathMappingList.h @@ -49,7 +49,7 @@ class PathMappingList { // By default, dump all pairs. void Dump(Stream *s, int pair_index = -1); - llvm::json::Value ToJSON(); + llvm::json::Value ToJSON() const; bool IsEmpty() const { std::lock_guard<std::mutex> lock(m_pairs_mutex); diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp index 72d8769c565a4..bb47b5888421a 100644 --- a/lldb/source/Interpreter/OptionValueArch.cpp +++ b/lldb/source/Interpreter/OptionValueArch.cpp @@ -33,7 +33,8 @@ void OptionValueArch::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -llvm::json::Value OptionValueArch::ToJSON(const ExecutionContext *exe_ctx) { +llvm::json::Value +OptionValueArch::ToJSON(const ExecutionContext *exe_ctx) const { if (m_current_value.IsValid()) { return llvm::json::Value(m_current_value.GetArchitectureName()); } diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp index 067172dd5690a..f6c14dee525e9 100644 --- a/lldb/source/Interpreter/OptionValueArray.cpp +++ b/lldb/source/Interpreter/OptionValueArray.cpp @@ -75,7 +75,8 @@ void OptionValueArray::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -llvm::json::Value OptionValueArray::ToJSON(const ExecutionContext *exe_ctx) { +llvm::json::Value +OptionValueArray::ToJSON(const ExecutionContext *exe_ctx) const { llvm::json::Array json_array; const uint32_t size = m_values.size(); for (uint32_t i = 0; i < size; ++i) diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp index 4ee8e59d19a7b..19e21dd6f4c9a 100644 --- a/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -88,7 +88,7 @@ void OptionValueDictionary::DumpValue(const ExecutionContext *exe_ctx, } llvm::json::Value -OptionValueDictionary::ToJSON(const ExecutionContext *exe_ctx) { +OptionValueDictionary::ToJSON(const ExecutionContext *exe_ctx) const { llvm::json::Object dict; for (const auto &value : m_values) { dict.try_emplace(value.first(), value.second->ToJSON(exe_ctx)); diff --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp b/lldb/source/Interpreter/OptionValueEnumeration.cpp index dd231f43e0d96..cf646233c80da 100644 --- a/lldb/source/Interpreter/OptionValueEnumeration.cpp +++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp @@ -38,7 +38,7 @@ void OptionValueEnumeration::DumpValue(const ExecutionContext *exe_ctx, } llvm::json::Value -OptionValueEnumeration::ToJSON(const ExecutionContext *exe_ctx) { +OptionValueEnumeration::ToJSON(const ExecutionContext *exe_ctx) const { for (const auto &enums : m_enumerations) { if (enums.value.value == m_current_value) return enums.cstring.GetStringRef(); diff --git a/lldb/source/Interpreter/OptionValueFileColonLine.cpp b/lldb/source/Interpreter/OptionValueFileColonLine.cpp index 312ee7f705e42..a4f65da8adb03 100644 --- a/lldb/source/Interpreter/OptionValueFileColonLine.cpp +++ b/lldb/source/Interpreter/OptionValueFileColonLine.cpp @@ -47,7 +47,7 @@ void OptionValueFileColonLine::DumpValue(const ExecutionContext *exe_ctx, } llvm::json::Value -OptionValueFileColonLine::ToJSON(const ExecutionContext *exe_ctx) { +OptionValueFileColonLine::ToJSON(const ExecutionContext *exe_ctx) const { StreamString stream; if (m_file_spec) stream << '"' << m_file_spec.GetPath().c_str() << '"'; diff --git a/lldb/source/Interpreter/OptionValueFileSpecList.cpp b/lldb/source/Interpreter/OptionValueFileSpecList.cpp index 84607eb8d0595..f252dc4603cc1 100644 --- a/lldb/source/Interpreter/OptionValueFileSpecList.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpecList.cpp @@ -42,7 +42,7 @@ void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx, } llvm::json::Value -OptionValueFileSpecList::ToJSON(const ExecutionContext *exe_ctx) { +OptionValueFileSpecList::ToJSON(const ExecutionContext *exe_ctx) const { std::lock_guard<std::recursive_mutex> lock(m_mutex); llvm::json::Array array; for (const auto &file_spec : m_current_value) diff --git a/lldb/source/Interpreter/OptionValueFormat.cpp b/lldb/source/Interpreter/OptionValueFormat.cpp index ab89f673e96fe..bc4e77923d10e 100644 --- a/lldb/source/Interpreter/OptionValueFormat.cpp +++ b/lldb/source/Interpreter/OptionValueFormat.cpp @@ -26,7 +26,8 @@ void OptionValueFormat::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, } } -llvm::json::Value OptionValueFormat::ToJSON(const ExecutionContext *exe_ctx) { +llvm::json::Value +OptionValueFormat::ToJSON(const ExecutionContext *exe_ctx) const { return FormatManager::GetFormatAsCString(m_current_value); } diff --git a/lldb/source/Interpreter/OptionValueFormatEntity.cpp b/lldb/source/Interpreter/OptionValueFormatEntity.cpp index addcfe019b4f7..d8b830115005c 100644 --- a/lldb/source/Interpreter/OptionValueFormatEntity.cpp +++ b/lldb/source/Interpreter/OptionValueFormatEntity.cpp @@ -61,7 +61,7 @@ void OptionValueFormatEntity::DumpValue(const ExecutionContext *exe_ctx, } llvm::json::Value -OptionValueFormatEntity::ToJSON(const ExecutionContext *exe_ctx) { +OptionValueFormatEntity::ToJSON(const ExecutionContext *exe_ctx) const { std::string escaped; EscapeBackticks(m_current_format, escaped); return escaped; diff --git a/lldb/source/Interpreter/OptionValueLanguage.cpp b/lldb/source/Interpreter/OptionValueLanguage.cpp index eb8eef0c600b2..0fdaacb02594e 100644 --- a/lldb/source/Interpreter/OptionValueLanguage.cpp +++ b/lldb/source/Interpreter/OptionValueLanguage.cpp @@ -29,7 +29,8 @@ void OptionValueLanguage::DumpValue(const ExecutionContext *exe_ctx, } } -llvm::json::Value OptionValueLanguage::ToJSON(const ExecutionContext *exe_ctx) { +llvm::json::Value +OptionValueLanguage::ToJSON(const ExecutionContext *exe_ctx) const { return Language::GetNameForLanguageType(m_current_value); } diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp index 757be839ada9a..95b8e64171455 100644 --- a/lldb/source/Interpreter/OptionValuePathMappings.cpp +++ b/lldb/source/Interpreter/OptionValuePathMappings.cpp @@ -35,7 +35,7 @@ void OptionValuePathMappings::DumpValue(const ExecutionContext *exe_ctx, } llvm::json::Value -OptionValuePathMappings::ToJSON(const ExecutionContext *exe_ctx) { +OptionValuePathMappings::ToJSON(const ExecutionContext *exe_ctx) const { return m_path_mappings.ToJSON(); } diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index ebea94db93d4e..cb71bffa8fe25 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -335,7 +335,7 @@ void OptionValueProperties::DumpValue(const ExecutionContext *exe_ctx, } llvm::json::Value -OptionValueProperties::ToJSON(const ExecutionContext *exe_ctx) { +OptionValueProperties::ToJSON(const ExecutionContext *exe_ctx) const { llvm::json::Object json_properties; const size_t num_properties = m_properties.size(); for (size_t i = 0; i < num_properties; ++i) { diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index 16456d110a933..0465b4280bbb1 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -180,7 +180,7 @@ void PathMappingList::Dump(Stream *s, int pair_index) { } } -llvm::json::Value PathMappingList::ToJSON() { +llvm::json::Value PathMappingList::ToJSON() const { llvm::json::Array entries; std::lock_guard<std::mutex> lock(m_pairs_mutex); for (const auto &pair : m_pairs) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits