summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-09-22 14:09:50 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-09-22 14:09:50 +0000
commit8817cca5ce782c187605ee08e1a7363aa5470534 (patch)
treea70f68125c16f17261abf4865bb60f46a053b51e /llvm/lib/MC/MCParser/AsmParser.cpp
parent402f807d9d0238cf7c7dd98bea52be221637d580 (diff)
downloadbcm5719-llvm-8817cca5ce782c187605ee08e1a7363aa5470534.tar.gz
bcm5719-llvm-8817cca5ce782c187605ee08e1a7363aa5470534.zip
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. llvm-svn: 191175
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index dcf54b0b942..c1f825ae785 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/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<const AsmRewrite *>(A);
- const AsmRewrite *AsmRewriteB = static_cast<const AsmRewrite *>(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())
OpenPOWER on IntegriCloud