mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
Use std::make_tuple to reduce code duplication.
Thanks to David Blaikie for the suggestion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242074 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cc383db66a
commit
6d0b72637c
@ -185,39 +185,20 @@ struct NMSymbol {
|
||||
}
|
||||
|
||||
static bool compareSymbolAddress(const NMSymbol &A, const NMSymbol &B) {
|
||||
bool AUndefined = A.Sym.getFlags() & SymbolRef::SF_Undefined;
|
||||
bool BUndefined = B.Sym.getFlags() & SymbolRef::SF_Undefined;
|
||||
if (AUndefined && !BUndefined)
|
||||
return true;
|
||||
if (!AUndefined && BUndefined)
|
||||
return false;
|
||||
if (A.Address < B.Address)
|
||||
return true;
|
||||
if (A.Address == B.Address && A.Name < B.Name)
|
||||
return true;
|
||||
if (A.Address == B.Address && A.Name == B.Name && A.Size < B.Size)
|
||||
return true;
|
||||
return false;
|
||||
bool ADefined = !(A.Sym.getFlags() & SymbolRef::SF_Undefined);
|
||||
bool BDefined = !(B.Sym.getFlags() & SymbolRef::SF_Undefined);
|
||||
return std::make_tuple(ADefined, A.Address, A.Name, A.Size) <
|
||||
std::make_tuple(BDefined, B.Address, B.Name, B.Size);
|
||||
}
|
||||
|
||||
static bool compareSymbolSize(const NMSymbol &A, const NMSymbol &B) {
|
||||
if (A.Size < B.Size)
|
||||
return true;
|
||||
if (A.Size == B.Size && A.Name < B.Name)
|
||||
return true;
|
||||
if (A.Size == B.Size && A.Name == B.Name && A.Address < B.Address)
|
||||
return true;
|
||||
return false;
|
||||
return std::make_tuple(A.Size, A.Name, A.Address) <
|
||||
std::make_tuple(B.Size, B.Name, B.Address);
|
||||
}
|
||||
|
||||
static bool compareSymbolName(const NMSymbol &A, const NMSymbol &B) {
|
||||
if (A.Name < B.Name)
|
||||
return true;
|
||||
if (A.Name == B.Name && A.Size < B.Size)
|
||||
return true;
|
||||
if (A.Name == B.Name && A.Size == B.Size && A.Address < B.Address)
|
||||
return true;
|
||||
return false;
|
||||
return std::make_tuple(A.Name, A.Size, A.Address) <
|
||||
std::make_tuple(B.Name, B.Size, B.Address);
|
||||
}
|
||||
|
||||
static char isSymbolList64Bit(SymbolicFile &Obj) {
|
||||
|
Loading…
Reference in New Issue
Block a user