[PATCH] D94667: [llvm-nm] - Move MachO specific logic out from the dumpSymbolNamesFromObject(). NFC.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 14 03:35:36 PST 2021
grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, enderby.
Herald added a subscriber: rupprecht.
grimar requested review of this revision.
Herald added a project: LLVM.
`dumpSymbolNamesFromObject` is the method that dumps symbol names.
It has 563 lines, mostly because of huge piece of MachO specific code.
In this patch I move it to separate helper method.
The new size of `dumpSymbolNamesFromObject` is 93 lines. With it it becomes
much easier to maintain it.
I had to change the type of 2 name fields to `std::string`, because MachO logic
uses temporarily buffer strings (e.g `ExportsNameBuffer`, `BindsNameBuffer` etc):
std::string ExportsNameBuffer;
raw_string_ostream EOS(ExportsNameBuffer);
these buffers were moved to `dumpSymbolsFromDLInfoMachO` by this patch and
invalidated after return. Technically, before this patch we had a situation
when local pointers (symbol names) were assigned to members of global static `SymbolList`,
what is dirty by itself.
https://reviews.llvm.org/D94667
Files:
llvm/tools/llvm-nm/llvm-nm.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94667.316612.patch
Type: text/x-patch
Size: 37239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210114/06e0410a/attachment.bin>
More information about the llvm-commits
mailing list