Skip to content

Commit b8491fa

Browse files
author
Alex B
committed
Address Feedback nr.1
1 parent 027ad8c commit b8491fa

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

llvm/include/llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class CompileUnit {
177177
}
178178

179179
// Provide access to the list of DW_AT_LLVM_stmt_sequence attributes that may
180-
// need to be patched
180+
// need to be patched.
181181
const StmtSeqListAttributesTy &getStmtSeqListAttributes() const {
182182
return StmtSeqListAttributes;
183183
}
@@ -218,7 +218,7 @@ class CompileUnit {
218218
void noteLocationAttribute(PatchLocation Attr);
219219

220220
// Record that the given DW_AT_LLVM_stmt_sequence attribute may need to be
221-
// patched later
221+
// patched later.
222222
void noteStmtSeqListAttribute(PatchLocation Attr);
223223

224224
/// Add a name accelerator entry for \a Die with \a Name.

llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp

+19-19
Original file line numberDiff line numberDiff line change
@@ -2202,36 +2202,36 @@ void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) {
22022202
DebugLineStrPool);
22032203
} else {
22042204
// Create TrackedRow objects for all input rows.
2205-
std::vector<TrackedRow> AllTrackedRows;
2206-
AllTrackedRows.reserve(LT->Rows.size());
2205+
std::vector<TrackedRow> InputRows;
2206+
InputRows.reserve(LT->Rows.size());
22072207
for (size_t i = 0; i < LT->Rows.size(); i++)
2208-
AllTrackedRows.emplace_back(TrackedRow{LT->Rows[i], i, false});
2208+
InputRows.emplace_back(TrackedRow{LT->Rows[i], i, false});
22092209

22102210
// This vector is the output line table (still in TrackedRow form).
2211-
std::vector<TrackedRow> NewRows;
2212-
NewRows.reserve(AllTrackedRows.size());
2211+
std::vector<TrackedRow> OutputRows;
2212+
OutputRows.reserve(InputRows.size());
22132213

22142214
// Current sequence of rows being extracted, before being inserted
2215-
// in NewRows.
2215+
// in OutputRows.
22162216
std::vector<TrackedRow> Seq;
2217-
Seq.reserve(AllTrackedRows.size());
2217+
Seq.reserve(InputRows.size());
22182218

22192219
const auto &FunctionRanges = Unit.getFunctionRanges();
22202220
std::optional<AddressRangeValuePair> CurrRange;
22212221

22222222
// FIXME: This logic is meant to generate exactly the same output as
22232223
// Darwin's classic dsymutil. There is a nicer way to implement this
2224-
// by simply putting all the relocated line info in NewRows and simply
2225-
// sorting NewRows before passing it to emitLineTableForUnit. This
2224+
// by simply putting all the relocated line info in OutputRows and simply
2225+
// sorting OutputRows before passing it to emitLineTableForUnit. This
22262226
// should be correct as sequences for a function should stay
22272227
// together in the sorted output. There are a few corner cases that
22282228
// look suspicious though, and that required to implement the logic
22292229
// this way. Revisit that once initial validation is finished.
22302230

22312231
// Iterate over the object file line info and extract the sequences
22322232
// that correspond to linked functions.
2233-
for (size_t i = 0; i < AllTrackedRows.size(); i++) {
2234-
TrackedRow TR = AllTrackedRows[i];
2233+
for (size_t i = 0; i < InputRows.size(); i++) {
2234+
TrackedRow TR = InputRows[i];
22352235

22362236
// Check whether we stepped out of the range. The range is
22372237
// half-open, but consider accepting the end address of the range if
@@ -2255,7 +2255,7 @@ void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) {
22552255
NextLine.Row.BasicBlock = 0;
22562256
NextLine.Row.EpilogueBegin = 0;
22572257
Seq.push_back(NextLine);
2258-
insertLineSequence(Seq, NewRows);
2258+
insertLineSequence(Seq, OutputRows);
22592259
}
22602260

22612261
if (!CurrRange)
@@ -2271,13 +2271,13 @@ void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) {
22712271
Seq.push_back(TR);
22722272

22732273
if (TR.Row.EndSequence)
2274-
insertLineSequence(Seq, NewRows);
2274+
insertLineSequence(Seq, OutputRows);
22752275
}
22762276

22772277
// Materialize the tracked rows into final DWARFDebugLine::Row objects.
22782278
LineTable.Rows.clear();
2279-
LineTable.Rows.reserve(NewRows.size());
2280-
for (auto &TR : NewRows)
2279+
LineTable.Rows.reserve(OutputRows.size());
2280+
for (auto &TR : OutputRows)
22812281
LineTable.Rows.push_back(TR.Row);
22822282

22832283
// Use OutputRowOffsets to store the offsets of each line table row in the
@@ -2292,8 +2292,8 @@ void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) {
22922292
hasStmtSeq ? &OutputRowOffsets : nullptr);
22932293

22942294
if (hasStmtSeq) {
2295-
assert(OutputRowOffsets.size() == NewRows.size() &&
2296-
"OutputRowOffsets size mismatch");
2295+
assert(OutputRowOffsets.size() == OutputRows.size() &&
2296+
"must have an offset for each row");
22972297

22982298
// Create a map of stmt sequence offsets to original row indices.
22992299
DenseMap<uint64_t, unsigned> SeqOffToOrigRow;
@@ -2302,8 +2302,8 @@ void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) {
23022302

23032303
// Create a map of original row indices to new row indices.
23042304
DenseMap<size_t, size_t> OrigRowToNewRow;
2305-
for (size_t i = 0; i < NewRows.size(); ++i)
2306-
OrigRowToNewRow[NewRows[i].OriginalRowIndex] = i;
2305+
for (size_t i = 0; i < OutputRows.size(); ++i)
2306+
OrigRowToNewRow[OutputRows[i].OriginalRowIndex] = i;
23072307

23082308
// Patch DW_AT_LLVM_stmt_sequence attributes in the compile unit DIE
23092309
// with the correct offset into the .debug_line section.

0 commit comments

Comments
 (0)