Skip to content

Commit 5d9b7e4

Browse files
committed
[lldb] Add ToJson for OptionValueFileColonLine
1 parent a87d7be commit 5d9b7e4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lldb/include/lldb/Interpreter/OptionValueFileColonLine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class OptionValueFileColonLine :
2929
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
3030
uint32_t dump_mask) override;
3131

32+
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
33+
3234
Status
3335
SetValueFromString(llvm::StringRef value,
3436
VarSetOperationType op = eVarSetOperationAssign) override;

lldb/source/Interpreter/OptionValueFileColonLine.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ void OptionValueFileColonLine::DumpValue(const ExecutionContext *exe_ctx,
4646
}
4747
}
4848

49+
llvm::json::Value
50+
OptionValueFileColonLine::ToJSON(const ExecutionContext *exe_ctx) {
51+
StreamString stream;
52+
if (m_file_spec)
53+
stream << '"' << m_file_spec.GetPath().c_str() << '"';
54+
if (m_line_number != LLDB_INVALID_LINE_NUMBER)
55+
stream.Printf(":%d", m_line_number);
56+
if (m_column_number != LLDB_INVALID_COLUMN_NUMBER)
57+
stream.Printf(":%d", m_column_number);
58+
59+
return llvm::json::Value(stream.GetString());
60+
}
61+
4962
Status OptionValueFileColonLine::SetValueFromString(llvm::StringRef value,
5063
VarSetOperationType op) {
5164
Status error;

0 commit comments

Comments
 (0)