[PATCH] D119028: [NFC] refactor the llvm-nm of symbol sorting

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 06:01:55 PST 2022


DiggerLin marked 2 inline comments as done.
DiggerLin added inline comments.


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:234-235
 
-static bool compareSymbolSize(const NMSymbol &A, const NMSymbol &B) {
-  return std::make_tuple(A.Size, A.Name, A.Address) <
-         std::make_tuple(B.Size, B.Name, B.Address);
-}
+  friend bool operator<(const NMSymbol &A, const NMSymbol &B);
+  friend bool operator>(const NMSymbol &A, const NMSymbol &B);
+};
----------------
jhenderson wrote:
> Since the `NMSymbol` class has no private members, do you need the `friend` operator declarations?
thanks , good catch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119028/new/

https://reviews.llvm.org/D119028



More information about the llvm-commits mailing list