aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-26 04:13:19 +0000
committerChris Lattner <sabre@nondot.org>2008-07-26 04:13:19 +0000
commit06036d3709955a53297b4cbe14e20db88f321470 (patch)
tree22bcc47363b36a463d0423eadf6dfefd57f4f275 /lib/Parse/ParseObjc.cpp
parent6bd6d0b9d8944c5e192097bef24f2becb83af172 (diff)
Pull protocol resolution of out ActOnStartClassInterface, this is also the
last client of the old ParseObjCProtocolReferences, so it also removes it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r--lib/Parse/ParseObjc.cpp55
1 files changed, 11 insertions, 44 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index cabb5bf69a..980105a02c 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -186,16 +186,17 @@ Parser::DeclTy *Parser::ParseObjCAtInterfaceDeclaration(
superClassLoc = ConsumeToken();
}
// Next, we need to check for any protocol references.
- llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
- SourceLocation endProtoLoc;
- if (Tok.is(tok::less)) {
- if (ParseObjCProtocolReferences(ProtocolRefs, endProtoLoc))
- return 0;
- }
- DeclTy *ClsType = Actions.ActOnStartClassInterface(
- atLoc, nameId, nameLoc,
- superClassId, superClassLoc, &ProtocolRefs[0],
- ProtocolRefs.size(), endProtoLoc, attrList);
+ llvm::SmallVector<Action::DeclTy*, 8> ProtocolRefs;
+ SourceLocation EndProtoLoc;
+ if (Tok.is(tok::less) &&
+ ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc))
+ return 0;
+
+ DeclTy *ClsType =
+ Actions.ActOnStartClassInterface(atLoc, nameId, nameLoc,
+ superClassId, superClassLoc,
+ &ProtocolRefs[0], ProtocolRefs.size(),
+ EndProtoLoc, attrList);
if (Tok.is(tok::l_brace))
ParseObjCClassInstanceVariables(ClsType, atLoc);
@@ -717,40 +718,6 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
/// '<' identifier-list '>'
///
bool Parser::
-ParseObjCProtocolReferences(llvm::SmallVectorImpl<IdentifierLocPair> &Protocols,
- SourceLocation &endLoc) {
- assert(Tok.is(tok::less) && "expected <");
-
- ConsumeToken(); // the "<"
-
- while (1) {
- if (Tok.isNot(tok::identifier)) {
- Diag(Tok, diag::err_expected_ident);
- SkipUntil(tok::greater);
- return true;
- }
- Protocols.push_back(std::make_pair(Tok.getIdentifierInfo(),
- Tok.getLocation()));
- ConsumeToken();
-
- if (Tok.isNot(tok::comma))
- break;
- ConsumeToken();
- }
-
- // Consume the '>'.
- if (Tok.is(tok::greater)) {
- endLoc = ConsumeAnyToken();
- return false;
- }
- Diag(Tok, diag::err_expected_greater);
- return true;
-}
-
-/// objc-protocol-refs:
-/// '<' identifier-list '>'
-///
-bool Parser::
ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclTy*> &Protocols,
bool WarnOnDeclarations, SourceLocation &EndLoc) {
assert(Tok.is(tok::less) && "expected <");