diff options
author | John McCall <rjmccall@apple.com> | 2010-02-13 01:04:05 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-02-13 01:04:05 +0000 |
commit | 7fe0b9ea2c8137c035402e6ea01dfdfbc93214cb (patch) | |
tree | f2563e0d6deec8c7a5457786b9d2e000ca96173b /lib/CodeGen/CGVtable.cpp | |
parent | c1ddcabef0b0e1185b6ea35d64a1ff41dabd7626 (diff) |
Switch the standard DeclarationName comparator to be a tri-valued comparator.
Use that while fixing a nasty misuse of qsort in vtable codegen which, somehow,
has not actually caused a crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index a5ba11f8ba..8c172a2134 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -1109,9 +1109,10 @@ private: } static int DclCmp(const void *p1, const void *p2) { - const CXXMethodDecl *MD1 = (const CXXMethodDecl *)p1; - const CXXMethodDecl *MD2 = (const CXXMethodDecl *)p2; - return (MD1->getIdentifier() - MD2->getIdentifier()); + const CXXMethodDecl *MD1 = *(const CXXMethodDecl *const *)p1; + const CXXMethodDecl *MD2 = *(const CXXMethodDecl *const *)p2; + + return (DeclarationName::compare(MD1->getDeclName(), MD2->getDeclName())); } void MergeForwarding() { @@ -1127,7 +1128,7 @@ private: for (A_t::iterator I = A.begin(), E = A.end(); I != E; ++I) { A_t::iterator J = I; - while (++J != E && DclCmp(*I, *J) == 0) + while (++J != E && DclCmp(I, J) == 0) if (DclIsSame(*I, *J)) { if (0) printf("connecting %s\n", (*I)->getNameAsCString()); ForwardUnique[*J] = *I; |