[PATCH] D108261: [DebugInfo] Fix end_sequence of debug_line in LTO Object

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 14 10:17:19 PST 2021


dblaikie added inline comments.


================
Comment at: llvm/lib/MC/MCDwarf.cpp:148
+  auto &Entries = MCLineDivisions[Sec];
+  if (!Entries.empty()) {
+    auto EndEntry = Entries.back();
----------------
kyulee wrote:
> dblaikie wrote:
> > When does this situation come up? (I think this question got lost from its previous place here: https://reviews.llvm.org/D108261#inline-1086075 during refactoring)
> > 
> > (if it is necessary, it might be suitable to use `find` on the `MCLineDivisions` rather than `operator[]` (so this call doesn't create an entry when it's empty/unused))
> Even though we have a range, we may not have any debug line entry in unit tests.
> 
> Makes sense using `find`. Will update it with additional assembly test.
Seems like we shouldn't be adding extra API surface area only for unit tests, though? But it's possible this comes up in real cases of empty functions - if that's the case (worth testing/validating), leaving a FIXME for when we remove/fix the existence of empty functions would be good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108261



More information about the llvm-commits mailing list