diff options
author | diggerlin <digger.llvm@gmail.com> | 2020-02-11 14:41:24 -0500 |
---|---|---|
committer | diggerlin <digger.llvm@gmail.com> | 2020-02-11 14:41:24 -0500 |
commit | 9c1a88c96457ffde71f13c74fd4d52a77d86cc9f (patch) | |
tree | ec053ab5245de49f94e52bcfcef08b54d9087901 | |
parent | 2040831d0566221aa01640123451b7839fc45920 (diff) | |
download | llvm-9c1a88c96457ffde71f13c74fd4d52a77d86cc9f.zip llvm-9c1a88c96457ffde71f13c74fd4d52a77d86cc9f.tar.gz llvm-9c1a88c96457ffde71f13c74fd4d52a77d86cc9f.tar.bz2 |
[NFC] Refactor the tuple of symbol information with structure for llvm-objdump
SUMMARY:
address the comment of
https://reviews.llvm.org/D74240#inline-676127
https://reviews.llvm.org/D74240#inline-675875
Reviewers: daltenty, jason liu, xiangling liao
Subscribers: wuzish, nemanjai, hiraditya
Differential Revision: https://reviews.llvm.org/D74240
-rw-r--r-- | llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h | 10 | ||||
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 10 |
2 files changed, 7 insertions, 13 deletions
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h index 05e47de..737edb3 100644 --- a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h +++ b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h @@ -22,15 +22,19 @@ struct SymbolInfoTy { StringRef Name; uint8_t Type; - SymbolInfoTy(uint64_t Addr, StringRef Name, uint8_t Type): - Addr(Addr),Name(Name),Type(Type) {}; + SymbolInfoTy(uint64_t Addr, StringRef Name, uint8_t Type) + : Addr(Addr), Name(Name), Type(Type){}; + + friend bool operator<(const SymbolInfoTy &P1, const SymbolInfoTy &P2) { + return std::tie(P1.Addr, P1.Name, P1.Type) < + std::tie(P2.Addr, P2.Name, P2.Type); + } }; using SectionSymbolsTy = std::vector<SymbolInfoTy>; template <typename T> class ArrayRef; -class StringRef; class MCContext; class MCInst; class MCSubtargetInfo; diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 6719aed..a1c37bc 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -341,16 +341,6 @@ static StringSet<> DisasmFuncsSet; StringSet<> FoundSectionSet; static StringRef ToolName; -static bool operator<(const SymbolInfoTy& P1 ,const SymbolInfoTy& P2) { - if (P1.Addr < P2.Addr) - return true; - - if (P1.Addr == P2.Addr) - return P1.Name < P2.Name; - - return false; -} - namespace { struct FilterResult { // True if the section should not be skipped. |