Skip to content

Commit d12b027

Browse files
committed
[lldb][lldb-dap] drop optional
1 parent ab74900 commit d12b027

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -585,22 +585,20 @@ llvm::json::Value toJSON(const SteppingGranularity &SG) {
585585
bool fromJSON(const json::Value &Params, StepInTarget &SIT, json::Path P) {
586586
json::ObjectMapper O(Params, P);
587587
return O && O.map("id", SIT.id) && O.map("label", SIT.label) &&
588-
O.mapOptional("line", SIT.line) &&
589-
O.mapOptional("column", SIT.column) &&
590-
O.mapOptional("endLine", SIT.endLine) &&
591-
O.mapOptional("endColumn", SIT.endColumn);
588+
O.map("line", SIT.line) && O.map("column", SIT.column) &&
589+
O.map("endLine", SIT.endLine) && O.map("endColumn", SIT.endColumn);
592590
}
593591

594592
llvm::json::Value toJSON(const StepInTarget &SIT) {
595593
json::Object target{{"id", SIT.id}, {"label", SIT.label}};
596594

597-
if (SIT.line && *SIT.line != LLDB_INVALID_LINE_NUMBER)
595+
if (SIT.line != LLDB_INVALID_LINE_NUMBER)
598596
target.insert({"line", SIT.line});
599-
if (SIT.column && *SIT.column != LLDB_INVALID_COLUMN_NUMBER)
597+
if (SIT.column != LLDB_INVALID_COLUMN_NUMBER)
600598
target.insert({"column", SIT.column});
601-
if (SIT.endLine && *SIT.endLine != LLDB_INVALID_LINE_NUMBER)
599+
if (SIT.endLine != LLDB_INVALID_LINE_NUMBER)
602600
target.insert({"endLine", SIT.endLine});
603-
if (SIT.endColumn && *SIT.endLine != LLDB_INVALID_COLUMN_NUMBER)
601+
if (SIT.endLine != LLDB_INVALID_COLUMN_NUMBER)
604602
target.insert({"endColumn", SIT.endColumn});
605603

606604
return target;

lldb/tools/lldb-dap/Protocol/ProtocolTypes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,20 +425,20 @@ struct StepInTarget {
425425
std::string label;
426426

427427
/// The line of the step-in target.
428-
std::optional<uint32_t> line = LLDB_INVALID_LINE_NUMBER;
428+
uint32_t line = LLDB_INVALID_LINE_NUMBER;
429429

430430
/// Start position of the range covered by the step in target. It is measured
431431
/// in UTF-16 code units and the client capability `columnsStartAt1`
432432
/// determines whether it is 0- or 1-based.
433-
std::optional<uint32_t> column = LLDB_INVALID_COLUMN_NUMBER;
433+
uint32_t column = LLDB_INVALID_COLUMN_NUMBER;
434434

435435
/// The end line of the range covered by the step-in target.
436-
std::optional<uint32_t> endLine = LLDB_INVALID_LINE_NUMBER;
436+
uint32_t endLine = LLDB_INVALID_LINE_NUMBER;
437437

438438
/// End position of the range covered by the step in target. It is measured in
439439
/// UTF-16 code units and the client capability `columnsStartAt1` determines
440440
/// whether it is 0- or 1-based.
441-
std::optional<uint32_t> endColumn = LLDB_INVALID_COLUMN_NUMBER;
441+
uint32_t endColumn = LLDB_INVALID_COLUMN_NUMBER;
442442
};
443443
bool fromJSON(const llvm::json::Value &, StepInTarget &, llvm::json::Path);
444444
llvm::json::Value toJSON(const StepInTarget &);

0 commit comments

Comments
 (0)