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; template 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.