diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-22 14:09:50 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-22 14:09:50 +0000 |
commit | 8817cca5ce782c187605ee08e1a7363aa5470534 (patch) | |
tree | a70f68125c16f17261abf4865bb60f46a053b51e /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 402f807d9d0238cf7c7dd98bea52be221637d580 (diff) | |
download | bcm5719-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/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 0dea844aeb9..0e56904ebde 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -699,9 +699,10 @@ namespace { }; } -static int ConstantIntSortPredicate(const void *P1, const void *P2) { - const ConstantInt *LHS = *(const ConstantInt*const*)P1; - const ConstantInt *RHS = *(const ConstantInt*const*)P2; +static int ConstantIntSortPredicate(ConstantInt *const *P1, + ConstantInt *const *P2) { + const ConstantInt *LHS = *P1; + const ConstantInt *RHS = *P2; if (LHS->getValue().ult(RHS->getValue())) return 1; if (LHS->getValue() == RHS->getValue()) |