diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-09-29 19:41:44 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-09-29 19:41:44 +0000 |
commit | 71b0addffbdeed29cc062c962e236c34107755d6 (patch) | |
tree | 457ea935563f007f07ff560f501e20317b5b7c86 /lib/Parse/ParseObjc.cpp | |
parent | cd01f17358dc8ef19338c0e2321138dd0a6160d9 (diff) |
Keep protocol source locations when parsing protocol references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index fdd031c66d..014f10edd4 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -148,10 +148,12 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration( rparenLoc = ConsumeParen(); // Next, we need to check for any protocol references. - SourceLocation EndProtoLoc; + SourceLocation LAngleLoc, EndProtoLoc; llvm::SmallVector<DeclPtrTy, 8> ProtocolRefs; + llvm::SmallVector<SourceLocation, 8> ProtocolLocs; if (Tok.is(tok::less) && - ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc)) + ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true, + LAngleLoc, EndProtoLoc)) return DeclPtrTy(); if (attrList) // categories don't support attributes. @@ -183,9 +185,11 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration( } // Next, we need to check for any protocol references. llvm::SmallVector<Action::DeclPtrTy, 8> ProtocolRefs; - SourceLocation EndProtoLoc; + llvm::SmallVector<SourceLocation, 8> ProtocolLocs; + SourceLocation LAngleLoc, EndProtoLoc; if (Tok.is(tok::less) && - ParseObjCProtocolReferences(ProtocolRefs, true, EndProtoLoc)) + ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true, + LAngleLoc, EndProtoLoc)) return DeclPtrTy(); DeclPtrTy ClsType = @@ -786,10 +790,12 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc, /// bool Parser:: ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &Protocols, - bool WarnOnDeclarations, SourceLocation &EndLoc) { + llvm::SmallVectorImpl<SourceLocation> &ProtocolLocs, + bool WarnOnDeclarations, + SourceLocation &LAngleLoc, SourceLocation &EndLoc) { assert(Tok.is(tok::less) && "expected <"); - ConsumeToken(); // the "<" + LAngleLoc = ConsumeToken(); // the "<" llvm::SmallVector<IdentifierLocPair, 8> ProtocolIdents; @@ -801,6 +807,7 @@ ParseObjCProtocolReferences(llvm::SmallVectorImpl<Action::DeclPtrTy> &Protocols, } ProtocolIdents.push_back(std::make_pair(Tok.getIdentifierInfo(), Tok.getLocation())); + ProtocolLocs.push_back(Tok.getLocation()); ConsumeToken(); if (Tok.isNot(tok::comma)) @@ -982,11 +989,13 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc, } // Last, and definitely not least, parse a protocol declaration. - SourceLocation EndProtoLoc; + SourceLocation LAngleLoc, EndProtoLoc; llvm::SmallVector<DeclPtrTy, 8> ProtocolRefs; + llvm::SmallVector<SourceLocation, 8> ProtocolLocs; if (Tok.is(tok::less) && - ParseObjCProtocolReferences(ProtocolRefs, false, EndProtoLoc)) + ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, false, + LAngleLoc, EndProtoLoc)) return DeclPtrTy(); DeclPtrTy ProtoType = |