Page MenuHomePhabricator

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

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



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
22 ↗(On Diff #111166)

Maybe SectionName or SectionNameInfo?

1188–1191 ↗(On Diff #111166)

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.

60–62 ↗(On Diff #111166)

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

72 ↗(On Diff #111166)

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

76 ↗(On Diff #111166)

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.
1188–1191 ↗(On Diff #111166)

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.