This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Simplify the code.
ClosedPublic

Authored by grimar on Jan 30 2019, 4:55 AM.

Details

Summary

We have a Field struct which has a StringRef member Str.

The code needs to create and keep alive the temporarily std::string variables because of that.
That is not convenient and makes the code be more complicated than it could be.

I see no reason to keep Str be StringRef and suggest to make it std::string.
This patch does that and also rearranges the code slightly to regroup it in a
more natural way after the change.

Diff Detail

Event Timeline

grimar created this revision.Jan 30 2019, 4:55 AM
jhenderson accepted this revision.Jan 30 2019, 5:34 AM

Two nits. Otherwise LGTM.

tools/llvm-readobj/ELFDumper.cpp
387

Could this still take a StringRef?

2962

clang-format?

This revision is now accepted and ready to land.Jan 30 2019, 5:34 AM
grimar marked 4 inline comments as done.Jan 30 2019, 6:03 AM

Thanks, James! Will address both your comments before commit.

This revision was automatically updated to reflect the committed changes.