From bd5ee505c94bb4002cc8c6e497f519c7265fa120 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 14 Mar 2015 00:20:13 +0000 Subject: CommandLine: Replace cold std::sort with array_pod_sort. Also replace an old use of qsort with it. Compiles down to the same thing but gives us some type safety. Safes a couple of kb on CommandLine.o. NFC. llvm-svn: 232236 --- llvm/lib/Support/CommandLine.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'llvm/lib/Support/CommandLine.cpp') diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index f761aa6fc1c..7e594409b82 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -19,6 +19,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm-c/Support.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringMap.h" @@ -1463,10 +1464,9 @@ void basic_parser_impl::printOptionNoValue(const Option &O, // -help and -help-hidden option implementation // -static int OptNameCompare(const void *LHS, const void *RHS) { - typedef std::pair pair_ty; - - return strcmp(((const pair_ty *)LHS)->first, ((const pair_ty *)RHS)->first); +static int OptNameCompare(const std::pair *LHS, + const std::pair *RHS) { + return strcmp(LHS->first, RHS->first); } // Copy Options into a vector so we can sort them as we like. @@ -1494,7 +1494,7 @@ static void sortOpts(StringMap