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/Support | |
| 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/Support')
| -rw-r--r-- | llvm/lib/Support/TargetRegistry.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/TargetRegistry.cpp b/llvm/lib/Support/TargetRegistry.cpp index 9c81327615c..0c90c17fefb 100644 --- a/llvm/lib/Support/TargetRegistry.cpp +++ b/llvm/lib/Support/TargetRegistry.cpp @@ -135,9 +135,9 @@ const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) { return TheTarget; } -static int TargetArraySortFn(const void *LHS, const void *RHS) { - typedef std::pair<StringRef, const Target*> pair_ty; - return ((const pair_ty*)LHS)->first.compare(((const pair_ty*)RHS)->first); +static int TargetArraySortFn(const std::pair<StringRef, const Target *> *LHS, + const std::pair<StringRef, const Target *> *RHS) { + return LHS->first.compare(RHS->first); } void TargetRegistry::printRegisteredTargetsForVersion() { |

