From: Benjamin Kramer Date: Sat, 14 Mar 2015 00:20:13 +0000 (+0000) Subject: CommandLine: Replace cold std::sort with array_pod_sort. X-Git-Tag: llvmorg-3.7.0-rc1~9260 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd5ee505c94bb4002cc8c6e497f519c7265fa120;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index f761aa6..7e59440 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