[llvm] [dsymutil] Fix line table sequence mapping for stmt_sequence attributes (PR #143656)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 22:56:46 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
index 8d8f4bea4..6cd06b617 100644
--- a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
@@ -2297,19 +2297,22 @@ void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) {
// Create a map of stmt sequence offsets to original row indices.
DenseMap<uint64_t, unsigned> SeqOffToOrigRow;
- // The DWARF parser's discovery of sequences can be incomplete. To ensure all
- // DW_AT_LLVM_stmt_sequence attributes can be patched, we build a map from
- // both the parser's results and a manual reconstruction.
+ // The DWARF parser's discovery of sequences can be incomplete. To
+ // ensure all DW_AT_LLVM_stmt_sequence attributes can be patched, we
+ // build a map from both the parser's results and a manual
+ // reconstruction.
if (!LT->Rows.empty()) {
// First, trust the sequences that the DWARF parser did identify.
for (const DWARFDebugLine::Sequence &Seq : LT->Sequences)
SeqOffToOrigRow.try_emplace(Seq.StmtSeqOffset, Seq.FirstRowIndex);
- // Second, manually find sequence boundaries and match them to the sorted
- // attributes to handle sequences the parser might have missed.
+ // Second, manually find sequence boundaries and match them to the
+ // sorted attributes to handle sequences the parser might have missed.
auto StmtAttrs = Unit.getStmtSeqListAttributes();
- llvm::sort(StmtAttrs, [](const PatchLocation &A,
- const PatchLocation &B) { return A.get() < B.get(); });
+ llvm::sort(StmtAttrs,
+ [](const PatchLocation &A, const PatchLocation &B) {
+ return A.get() < B.get();
+ });
std::vector<size_t> SeqStartRows;
SeqStartRows.push_back(0);
@@ -2317,9 +2320,9 @@ void DWARFLinker::DIECloner::generateLineTableForUnit(CompileUnit &Unit) {
if (LT->Rows[i].EndSequence)
SeqStartRows.push_back(i + 1);
- // Correlate the sorted attributes with the reconstructed sequence starts.
- // This provides a partial mapping if counts are mismatched, maximizing the
- // number of correctly patched attributes.
+ // Correlate the sorted attributes with the reconstructed sequence
+ // starts. This provides a partial mapping if counts are mismatched,
+ // maximizing the number of correctly patched attributes.
size_t NumMappings = std::min(StmtAttrs.size(), SeqStartRows.size());
for (size_t i = 0; i < NumMappings; ++i) {
SeqOffToOrigRow.try_emplace(StmtAttrs[i].get(), SeqStartRows[i]);
``````````
</details>
https://github.com/llvm/llvm-project/pull/143656
More information about the llvm-commits
mailing list