[lld] [llvm] [Symbolizer] Support for Missing Line Numbers. (PR #82240)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 11:39:32 PDT 2024
================
@@ -1337,7 +1339,22 @@ uint32_t DWARFDebugLine::LineTable::lookupAddressImpl(
DWARFDebugLine::Sequence::orderByHighPC);
if (It == Sequences.end() || It->SectionIndex != Address.SectionIndex)
return UnknownRowIndex;
- return findRowInSeq(*It, Address);
+
+ uint32_t RowIndex = findRowInSeq(*It, Address);
+
+ if (RowIndex == UnknownRowIndex)
+ return RowIndex;
+
+ // Approximation will only be attempted if a valid RowIndex exists.
+ if (Approximation && Approximation->Report) {
----------------
dwblaikie wrote:
I think it'd be nicer/simpler if the presence of a non-null `Approximation` was enough to communicate the request to report approximate line numbers - then it wouldn't need to be a struct, it can be just the output bool* of `IsApproximateLine`. Saves having two layers of testing here - if it's non-null, it's a request to use an approximate line, and a means to report that it is approximated.
Also, to reduce indentation, either roll the inverse of this condition into the previous `if`/early return, like this:
```
if (RowIndex == UnknownRowIndex || !Approximation)
return RowIndex;
```
(assuming Approximation has been modified to be bool*)
or have another early return here, like:
```
if (RowIndex == UnknownRowIndex)
return RowIndex;
if (!Approximation)
return RowIndex
for (...) etc...
```
https://github.com/llvm/llvm-project/pull/82240
More information about the llvm-commits
mailing list