Skip to content

Commit ef75e4d

Browse files
committed
fix comments and conventions
1 parent 044fd90 commit ef75e4d

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

lldb/tools/lldb-dap/Breakpoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() {
7878
breakpoint.column = column;
7979
breakpoint.source = CreateSource(line_entry);
8080
} else {
81-
// Breakpoint made by assembly
81+
// Assembly breakpoint.
8282
auto symbol = bp_addr.GetSymbol();
8383
if (symbol.IsValid()) {
8484
breakpoint.line =

lldb/tools/lldb-dap/DAP.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,13 +1625,13 @@ std::vector<protocol::Breakpoint> DAP::SetSourceBreakpoints(
16251625
const std::optional<std::vector<protocol::SourceBreakpoint>> &breakpoints) {
16261626
std::vector<protocol::Breakpoint> response_breakpoints;
16271627
if (source.sourceReference) {
1628-
// breakpoint set by assembly source.
1628+
// Breakpoint set by assembly source.
16291629
auto &existing_breakpoints =
16301630
m_source_assembly_breakpoints[*source.sourceReference];
16311631
response_breakpoints =
16321632
SetSourceBreakpoints(source, breakpoints, existing_breakpoints);
16331633
} else {
1634-
// breakpoint set by a regular source file.
1634+
// Breakpoint set by a regular source file.
16351635
const auto path = source.path.value_or("");
16361636
auto &existing_breakpoints = m_source_breakpoints[path];
16371637
response_breakpoints =
@@ -1659,16 +1659,17 @@ std::vector<protocol::Breakpoint> DAP::SetSourceBreakpoints(
16591659
existing_breakpoints.try_emplace(bp_pos, src_bp);
16601660
// We check if this breakpoint already exists to update it.
16611661
if (inserted) {
1662-
if (auto error = iv->second.SetBreakpoint(source)) {
1662+
if (llvm::Error error = iv->second.SetBreakpoint(source)) {
16631663
protocol::Breakpoint invalid_breakpoint;
16641664
invalid_breakpoint.message = llvm::toString(std::move(error));
16651665
invalid_breakpoint.verified = false;
16661666
response_breakpoints.push_back(std::move(invalid_breakpoint));
16671667
existing_breakpoints.erase(iv);
16681668
continue;
16691669
}
1670-
} else
1670+
} else {
16711671
iv->second.UpdateBreakpoint(src_bp);
1672+
}
16721673

16731674
protocol::Breakpoint response_breakpoint =
16741675
iv->second.ToProtocolBreakpoint();

lldb/tools/lldb-dap/DAP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ struct DAP {
219219
/// @}
220220

221221
/// Number of lines of assembly code to show when no debug info is available.
222-
static constexpr uint32_t number_of_assembly_lines_for_nodebug = 32;
222+
static constexpr uint32_t k_number_of_assembly_lines_for_nodebug = 32;
223223

224224
/// Creates a new DAP sessions.
225225
///

lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ BreakpointLocationsRequestHandler::Run(
2727

2828
// Find all relevant lines & columns.
2929
std::vector<std::pair<uint32_t, uint32_t>> locations;
30-
if (args.source.sourceReference)
30+
if (args.source.sourceReference) {
3131
locations = GetAssemblyBreakpointLocations(*args.source.sourceReference,
3232
start_line, end_line);
33+
}
3334
else {
3435
std::string path = args.source.path.value_or("");
3536
locations = GetSourceBreakpointLocations(
@@ -114,7 +115,7 @@ BreakpointLocationsRequestHandler::GetAssemblyBreakpointLocations(
114115
if (!symbol.IsValid())
115116
return locations;
116117

117-
// start_line is relative to the symbol's start address
118+
// start_line is relative to the symbol's start address.
118119
lldb::SBInstructionList insts = symbol.GetInstructions(dap.target);
119120
if (insts.GetSize() > (start_line - 1))
120121
locations.reserve(insts.GetSize() - (start_line - 1));

lldb/tools/lldb-dap/Handler/SourceRequestHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ SourceRequestHandler::Run(const protocol::SourceArguments &args) const {
5151
} else {
5252
// No valid symbol, just return the disassembly.
5353
lldb::SBInstructionList insts = dap.target.ReadInstructions(
54-
address, dap.number_of_assembly_lines_for_nodebug);
54+
address, dap.k_number_of_assembly_lines_for_nodebug);
5555
insts.GetDescription(stream, exe_ctx);
5656
}
5757

lldb/tools/lldb-dap/SourceBreakpoint.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ llvm::Error SourceBreakpoint::SetBreakpoint(const protocol::Source &source) {
4545
"Invalid line number.");
4646

4747
if (source.sourceReference) {
48-
// breakpoint set by assembly source.
48+
// Breakpoint set by assembly source.
4949
lldb::SBAddress source_address(*source.sourceReference, m_dap.target);
5050
if (!source_address.IsValid())
5151
return llvm::createStringError(llvm::inconvertibleErrorCode(),
5252
"Invalid sourceReference.");
5353

5454
lldb::SBSymbol symbol = source_address.GetSymbol();
5555
if (!symbol.IsValid()) {
56-
// Not yet supporting breakpoints in assembly without a valid symbol.
56+
// FIXME: Support assembly breakpoints without a valid symbol.
5757
return llvm::createStringError(llvm::inconvertibleErrorCode(),
5858
"Breakpoints in assembly without a valid "
5959
"symbol are not supported yet.");
@@ -70,7 +70,7 @@ llvm::Error SourceBreakpoint::SetBreakpoint(const protocol::Source &source) {
7070

7171
m_bp = m_dap.target.BreakpointCreateBySBAddress(address);
7272
} else {
73-
// breakpoint set by a regular source file.
73+
// Breakpoint set by a regular source file.
7474
const auto source_path = source.path.value_or("");
7575
lldb::SBFileSpecList module_list;
7676
m_bp = m_dap.target.BreakpointCreateByLocation(source_path.c_str(), m_line,

0 commit comments

Comments
 (0)