This is an archive of the discontinued LLVM Phabricator instance.

[llvm-dwarfdump] - Refactor section name/uniqueness gathering.
ClosedPublic

Authored by grimar on Aug 15 2017, 7:58 AM.

Details

Summary

As was requested in D36313 thread,

with this patch section names and uniqueness calculated once,
and not every time when a range is dumped.

Diff Detail

Event Timeline

grimar created this revision.Aug 15 2017, 7:58 AM
dblaikie added inline comments.Aug 15 2017, 8:07 AM
include/llvm/DebugInfo/DWARF/DWARFSection.h
22

Maybe SectionName or SectionNameInfo?

lib/DebugInfo/DWARF/DWARFContext.cpp
1198–1201

Reckon it might be worth doing this lazily (inside getSectionNames)? So it's not computed if it's not needed?

I guess if we're already walking all the sections and getting their names, this is probably cheap enough to do unconditionally.

lib/DebugInfo/DWARF/DWARFDie.cpp
60–63

Similarly, probably call these SectionNames and getSectionNames (& similarly inside DWARFObject)

72

Can probably skip DumpOpts.Brief here, since Sections will be empty in that case?

75–76

does format not support StringRef? Or stream it out directly:

OS << " \"" << Name << '\"';

Save having to str().c_str() it.

grimar updated this revision to Diff 111179.Aug 15 2017, 8:40 AM
  • All comments addressed.
lib/DebugInfo/DWARF/DWARFContext.cpp
1198–1201

I tried both ways when wrote this patch. Non-lazy way was a bit shorter and does not have problem
with calling non-const methods for const object, that is why I posted it initially.
I changed to lazy one if you prefer it.

dblaikie accepted this revision.Aug 15 2017, 8:45 AM

Nah, that's OK - just do it the non-lazy (original) way. Can muck with it if it ever turns out to be a real issue.

This revision is now accepted and ready to land.Aug 15 2017, 8:45 AM
This revision was automatically updated to reflect the committed changes.