[llvm] 9c1a88c - [NFC] Refactor the tuple of symbol information with structure for llvm-objdump
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 11:41:47 PST 2020
Author: diggerlin
Date: 2020-02-11T14:41:24-05:00
New Revision: 9c1a88c96457ffde71f13c74fd4d52a77d86cc9f
URL: https://github.com/llvm/llvm-project/commit/9c1a88c96457ffde71f13c74fd4d52a77d86cc9f
DIFF: https://github.com/llvm/llvm-project/commit/9c1a88c96457ffde71f13c74fd4d52a77d86cc9f.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
llvm/tools/llvm-objdump/llvm-objdump.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
index 05e47deadfc6..737edb3ae21a 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 6719aed44912..a1c37bc8bff4 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.
More information about the llvm-commits
mailing list