[Lldb-commits] [PATCH] D151919: [lldb][NFCI] Apply IndexEntry to DWARFUnitHeader outside of extraction

Felipe de Azevedo Piovezan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 2 05:31:54 PDT 2023


fdeazeve accepted this revision.
fdeazeve added a comment.

I'm not exactly familiar with DWOs, but the code motions LGTM!



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:882
+  // we have a valid one to set it to.
+  assert(index_entry);
+  assert(!m_index_entry);
----------------
If LLVM's function is like this as well, we shouldn't do anything now and just refactor it later once we make the switch. But a pointer parameter in a function that asserts not null immediately is more expressive as a reference. Note that, in the code where this is called, we have a:

```
if (ptr)
  ApplyIndex(ptr)
```

So the assert is not needed, as the callee respects the contract and can do a `*ptr`



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151919/new/

https://reviews.llvm.org/D151919



More information about the lldb-commits mailing list