diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-14 13:32:49 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-14 13:32:49 +0000 |
commit | 0eb262fb28dfdad02413a91892c8ad5c14ba88c8 (patch) | |
tree | e3d05c2860002a43cc7e2a4d54d16642d155f553 /clang/lib/AST/ASTContext.cpp | |
parent | 5caa50e4691b27aa455ce7f4a74f68bd98a47f29 (diff) | |
download | bcm5719-llvm-0eb262fb28dfdad02413a91892c8ad5c14ba88c8.tar.gz bcm5719-llvm-0eb262fb28dfdad02413a91892c8ad5c14ba88c8.zip |
Sort ObjCProtocolDecls with array_pod_sort.
The predicate is essentially a string comparison. NFC.
llvm-svn: 232264
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4be2436dc63..932bc1cb86d 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -3521,9 +3521,9 @@ QualType ASTContext::getPackExpansionType(QualType Pattern, /// CmpProtocolNames - Comparison predicate for sorting protocols /// alphabetically. -static bool CmpProtocolNames(const ObjCProtocolDecl *LHS, - const ObjCProtocolDecl *RHS) { - return LHS->getDeclName() < RHS->getDeclName(); +static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, + ObjCProtocolDecl *const *RHS) { + return DeclarationName::compare((*LHS)->getDeclName(), (*RHS)->getDeclName()); } static bool areSortedAndUniqued(ObjCProtocolDecl * const *Protocols, @@ -3534,7 +3534,7 @@ static bool areSortedAndUniqued(ObjCProtocolDecl * const *Protocols, return false; for (unsigned i = 1; i != NumProtocols; ++i) - if (!CmpProtocolNames(Protocols[i-1], Protocols[i]) || + if (CmpProtocolNames(&Protocols[i - 1], &Protocols[i]) >= 0 || Protocols[i]->getCanonicalDecl() != Protocols[i]) return false; return true; @@ -3545,7 +3545,7 @@ static void SortAndUniqueProtocols(ObjCProtocolDecl **Protocols, ObjCProtocolDecl **ProtocolsEnd = Protocols+NumProtocols; // Sort protocols, keyed by name. - std::sort(Protocols, Protocols+NumProtocols, CmpProtocolNames); + llvm::array_pod_sort(Protocols, ProtocolsEnd, CmpProtocolNames); // Canonicalize. for (unsigned I = 0, N = NumProtocols; I != N; ++I) |