mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
Provide basic type safety for array_pod_sort comparators.
This makes using array_pod_sort significantly safer. The implementation relies on function pointer casting but that should be safe as we're dealing with void* here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191175 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -42,9 +42,9 @@ const MCSymbol *MCELFObjectTargetWriter::undefinedExplicitRelSym(const MCValue &
|
||||
// ELF doesn't require relocations to be in any order. We sort by the r_offset,
|
||||
// just to match gnu as for easier comparison. The use type and index is an
|
||||
// arbitrary way of making the sort deterministic.
|
||||
static int cmpRel(const void *AP, const void *BP) {
|
||||
const ELFRelocationEntry &A = *(const ELFRelocationEntry *)AP;
|
||||
const ELFRelocationEntry &B = *(const ELFRelocationEntry *)BP;
|
||||
static int cmpRel(const ELFRelocationEntry *AP, const ELFRelocationEntry *BP) {
|
||||
const ELFRelocationEntry &A = *AP;
|
||||
const ELFRelocationEntry &B = *BP;
|
||||
if (A.r_offset != B.r_offset)
|
||||
return B.r_offset - A.r_offset;
|
||||
if (B.Type != A.Type)
|
||||
|
||||
Reference in New Issue
Block a user