Assert that a cmp function defines a total order.

Thanks to David Blaikie for noticing it.

llvm-svn: 257796
This commit is contained in:
Rafael Espindola 2016-01-14 20:28:25 +00:00
parent d5354fdddb
commit 56cb2734e3
1 changed files with 2 additions and 3 deletions

View File

@ -334,9 +334,8 @@ static int cmpRel(const ELFRelocationEntry *AP, const ELFRelocationEntry *BP) {
const ELFRelocationEntry &B = *BP;
if (A.Offset != B.Offset)
return B.Offset - A.Offset;
if (B.Type != A.Type)
return A.Type - B.Type;
return 0;
assert(B.Type != A.Type && "We don't have a total order");
return A.Type - B.Type;
}
void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm,