move sorting of qualifying protocols from the parser into
sema. This allows clients of the parser to have the unmolested
list if desired, and guarantees that noone can create an
ObjCQualifiedInterfaceType with an unsorted list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49310 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index dfd00ec..2aee03a 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -701,18 +701,11 @@
MethodImplKind, isVariadic);
}
-/// CmpProtocolVals - Comparison predicate for sorting protocols.
-static bool CmpProtocolVals(const IdentifierInfo* const& lhs,
- const IdentifierInfo* const& rhs) {
- return strcmp(lhs->getName(), rhs->getName()) < 0;
-}
-
/// objc-protocol-refs:
/// '<' identifier-list '>'
///
bool Parser::ParseObjCProtocolReferences(
- llvm::SmallVectorImpl<IdentifierInfo*> &ProtocolRefs, SourceLocation &endLoc)
-{
+ llvm::SmallVectorImpl<IdentifierInfo*> &ProtocolRefs, SourceLocation &endLoc){
assert(Tok.is(tok::less) && "expected <");
ConsumeToken(); // the "<"
@@ -731,13 +724,6 @@
ConsumeToken();
}
- // Sort protocols, keyed by name.
- // Later on, we remove duplicates.
- std::stable_sort(ProtocolRefs.begin(), ProtocolRefs.end(), CmpProtocolVals);
-
- // Make protocol names unique.
- ProtocolRefs.erase(std::unique(ProtocolRefs.begin(), ProtocolRefs.end()),
- ProtocolRefs.end());
// Consume the '>'.
if (Tok.is(tok::greater)) {
endLoc = ConsumeAnyToken();