summaryrefslogtreecommitdiff
path: root/include/llvm/Support/PassNameParser.h
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
commit0d293e45b66c742fdbc3998209bb20ed6c5806bf (patch)
treeb94e3298127f119ce2169436e5c50e2f47401d56 /include/llvm/Support/PassNameParser.h
parent7f80b75b963781d81b772ae2f3a35dc74e1b6457 (diff)
downloadllvm-0d293e45b66c742fdbc3998209bb20ed6c5806bf.tar.gz
llvm-0d293e45b66c742fdbc3998209bb20ed6c5806bf.tar.bz2
llvm-0d293e45b66c742fdbc3998209bb20ed6c5806bf.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PassNameParser.h')
-rw-r--r--include/llvm/Support/PassNameParser.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/llvm/Support/PassNameParser.h b/include/llvm/Support/PassNameParser.h
index a73dc8ff28..c0914b1f2f 100644
--- a/include/llvm/Support/PassNameParser.h
+++ b/include/llvm/Support/PassNameParser.h
@@ -86,10 +86,9 @@ public:
private:
// ValLessThan - Provide a sorting comparator for Values elements...
- static int ValLessThan(const void *VT1, const void *VT2) {
- typedef PassNameParser::OptionInfo ValType;
- return std::strcmp(static_cast<const ValType *>(VT1)->Name,
- static_cast<const ValType *>(VT2)->Name);
+ static int ValLessThan(const PassNameParser::OptionInfo *VT1,
+ const PassNameParser::OptionInfo *VT2) {
+ return std::strcmp(VT1->Name, VT2->Name);
}
};