[all-commits] [llvm/llvm-project] bfb8f4: [llvm-nm] - Move MachO specific logic out from the...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Fri Jan 15 01:24:08 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bfb8f45ef3f46102d290f11039faa82456c920ae
      https://github.com/llvm/llvm-project/commit/bfb8f45ef3f46102d290f11039faa82456c920ae
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2021-01-15 (Fri, 15 Jan 2021)

  Changed paths:
    M llvm/tools/llvm-nm/llvm-nm.cpp

  Log Message:
  -----------
  [llvm-nm] - Move MachO specific logic out from the dumpSymbolNamesFromObject(). NFC.

`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.

Differential revision: https://reviews.llvm.org/D94667




More information about the All-commits mailing list