From 0d293e45b66c742fdbc3998209bb20ed6c5806bf Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 22 Sep 2013 14:09:50 +0000 Subject: 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 --- lib/MC/MCParser/AsmParser.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/MC/MCParser') diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index dcf54b0b94..c1f825ae78 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -4059,9 +4059,8 @@ bool AsmParser::parseDirectiveMSAlign(SMLoc IDLoc, ParseStatementInfo &Info) { // We are comparing pointers, but the pointers are relative to a single string. // Thus, this should always be deterministic. -static int rewritesSort(const void *A, const void *B) { - const AsmRewrite *AsmRewriteA = static_cast(A); - const AsmRewrite *AsmRewriteB = static_cast(B); +static int rewritesSort(const AsmRewrite *AsmRewriteA, + const AsmRewrite *AsmRewriteB) { if (AsmRewriteA->Loc.getPointer() < AsmRewriteB->Loc.getPointer()) return -1; if (AsmRewriteB->Loc.getPointer() < AsmRewriteA->Loc.getPointer()) -- cgit v1.2.3