diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-01 21:23:57 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-01 21:23:57 +0000 |
commit | f61026758145df2f845f9c28e89f53c084d35cb2 (patch) | |
tree | 24699428a99f060286b52844b9d54089e363da38 /clang/lib/Parse/ParseObjc.cpp | |
parent | c51118238c9a05a3113ce0057bb10169b583a6c5 (diff) | |
download | bcm5719-llvm-f61026758145df2f845f9c28e89f53c084d35cb2.tar.gz bcm5719-llvm-f61026758145df2f845f9c28e89f53c084d35cb2.zip |
Eliminate ObjCForwardProtocolDecl, which is redundant now that
ObjCProtocolDecl modules forward declarations properly.
llvm-svn: 147415
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 83b1ed0c3c2..8260d188a34 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -50,15 +50,13 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() { } case tok::objc_protocol: { ParsedAttributes attrs(AttrFactory); - SingleDecl = ParseObjCAtProtocolDeclaration(AtLoc, attrs); - break; + return ParseObjCAtProtocolDeclaration(AtLoc, attrs); } case tok::objc_implementation: SingleDecl = ParseObjCAtImplementationDeclaration(AtLoc); break; case tok::objc_end: return ParseObjCAtEndDeclaration(AtLoc); - break; case tok::objc_compatibility_alias: SingleDecl = ParseObjCAtAliasDeclaration(AtLoc); break; @@ -1349,8 +1347,9 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl, /// "@protocol identifier ;" should be resolved as "@protocol /// identifier-list ;": objc-interface-decl-list may not start with a /// semicolon in the first alternative if objc-protocol-refs are omitted. -Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, - ParsedAttributes &attrs) { +Parser::DeclGroupPtrTy +Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, + ParsedAttributes &attrs) { assert(Tok.isObjCAtKeyword(tok::objc_protocol) && "ParseObjCAtProtocolDeclaration(): Expected @protocol"); ConsumeToken(); // the "protocol" identifier @@ -1358,12 +1357,12 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, if (Tok.is(tok::code_completion)) { Actions.CodeCompleteObjCProtocolDecl(getCurScope()); cutOffParsing(); - return 0; + return DeclGroupPtrTy(); } if (Tok.isNot(tok::identifier)) { Diag(Tok, diag::err_expected_ident); // missing protocol name. - return 0; + return DeclGroupPtrTy(); } // Save the protocol name, then consume it. IdentifierInfo *protocolName = Tok.getIdentifierInfo(); @@ -1388,7 +1387,7 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, if (Tok.isNot(tok::identifier)) { Diag(Tok, diag::err_expected_ident); SkipUntil(tok::semi); - return 0; + return DeclGroupPtrTy(); } ProtocolRefs.push_back(IdentifierLocPair(Tok.getIdentifierInfo(), Tok.getLocation())); @@ -1399,7 +1398,7 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, } // Consume the ';'. if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@protocol")) - return 0; + return DeclGroupPtrTy(); return Actions.ActOnForwardProtocolDeclaration(AtLoc, &ProtocolRefs[0], @@ -1415,7 +1414,7 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, if (Tok.is(tok::less) && ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, false, LAngleLoc, EndProtoLoc)) - return 0; + return DeclGroupPtrTy(); Decl *ProtoType = Actions.ActOnStartProtocolInterface(AtLoc, protocolName, nameLoc, @@ -1425,7 +1424,7 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, EndProtoLoc, attrs.getList()); ParseObjCInterfaceDeclList(tok::objc_protocol, ProtoType); - return ProtoType; + return Actions.ConvertDeclToDeclGroup(ProtoType); } /// objc-implementation: |