llvm.org GIT mirror llvm / 6d0b726
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 Rafael Espindola 5 years ago
1 changed file(s) with 8 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
184184 }
185185
186186 static bool compareSymbolAddress(const NMSymbol &A, const NMSymbol &B) {
187 bool AUndefined = A.Sym.getFlags() & SymbolRef::SF_Undefined;
188 bool BUndefined = B.Sym.getFlags() & SymbolRef::SF_Undefined;
189 if (AUndefined && !BUndefined)
190 return true;
191 if (!AUndefined && BUndefined)
192 return false;
193 if (A.Address < B.Address)
194 return true;
195 if (A.Address == B.Address && A.Name < B.Name)
196 return true;
197 if (A.Address == B.Address && A.Name == B.Name && A.Size < B.Size)
198 return true;
199 return false;
187 bool ADefined = !(A.Sym.getFlags() & SymbolRef::SF_Undefined);
188 bool BDefined = !(B.Sym.getFlags() & SymbolRef::SF_Undefined);
189 return std::make_tuple(ADefined, A.Address, A.Name, A.Size) <
190 std::make_tuple(BDefined, B.Address, B.Name, B.Size);
200191 }
201192
202193 static bool compareSymbolSize(const NMSymbol &A, const NMSymbol &B) {
203 if (A.Size < B.Size)
204 return true;
205 if (A.Size == B.Size && A.Name < B.Name)
206 return true;
207 if (A.Size == B.Size && A.Name == B.Name && A.Address < B.Address)
208 return true;
209 return false;
194 return std::make_tuple(A.Size, A.Name, A.Address) <
195 std::make_tuple(B.Size, B.Name, B.Address);
210196 }
211197
212198 static bool compareSymbolName(const NMSymbol &A, const NMSymbol &B) {
213 if (A.Name < B.Name)
214 return true;
215 if (A.Name == B.Name && A.Size < B.Size)
216 return true;
217 if (A.Name == B.Name && A.Size == B.Size && A.Address < B.Address)
218 return true;
219 return false;
199 return std::make_tuple(A.Name, A.Size, A.Address) <
200 std::make_tuple(B.Name, B.Size, B.Address);
220201 }
221202
222203 static char isSymbolList64Bit(SymbolicFile &Obj) {