[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 16:14:00 PST 2021


dblaikie added inline comments.


================
Comment at: llvm/lib/MC/MCDwarf.cpp:148
+  // which may directly use .loc/.file directives.
+  if (MCLineDivisions.count(Sec)) {
+    auto &Entries = MCLineDivisions[Sec];
----------------
kyulee wrote:
> dblaikie wrote:
> > find is preferred over count - so that the result can be used rather than a duplicate lookup:
> > ```
> > auto I = MCLineDivisions.find(Sec);
> > if (I != MCLineDivisions.end()) {
> >   auto &Entries = I->second;
> >   ...
> > }
> > ```
> > 
> > Though I'm still curious to better understand under what conditions this is needed.
> Yea. `find` seems better since I need to use the map anyhow inside. Will update it.
> 
> As commented above in the code, the assembly output path (MCAsmStreamer as opposed to MCObjectStreamer), the line entry is not added instead .loc directives are emitted during the function emission. So, the line entries are often irrelevant in the assembly output except a certain target -- I guess XCOFF shown below in the tests.
> I was thinking to check streamer and specialize this logic outside this, but not sure exactly how to do so.
Ah, OK! Right - the solution to that would be to have a virtual function in MCStreamer that's differently implemented (a no-op in the asm streamer case - maybe someone'll eventually extend the assembly syntax to support terminating line contributions - so nodebug could be properly done in assembly) this would be side-by-side with the MCStreamer::emitDwarfLocDirective - or, perhaps it could use that specific function, with an extra parameter or flag value for "end entry"?


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