summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-07 01:20:12 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-07 01:20:12 +0000
commitc7c6431860dac773594f47db50d57c61361144b7 (patch)
treeb1e2919f13cafc2a6354d14afe851d2dde48c78f /clang/lib/Parse
parentb58514e613323d3907ba67a3279cacd37c673059 (diff)
downloadbcm5719-llvm-c7c6431860dac773594f47db50d57c61361144b7.tar.gz
bcm5719-llvm-c7c6431860dac773594f47db50d57c61361144b7.zip
Change ObjCContainerDecl to contain the entire range for the '@end'
piece of the declaration. The '@' and the 'end' are separate tokens, and require two SourceLocations to accurately track. This change was motivated because ObjCContainerDecl::getSourceRange() would previously not return the entire range of the declaration (the 'end' would be left off). llvm-svn: 92891
Diffstat (limited to 'clang/lib/Parse')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 9904a2ca85d..eb58ebc0e1a 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -309,7 +309,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
llvm::SmallVector<DeclGroupPtrTy, 8> allTUVariables;
tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
- SourceLocation AtEndLoc;
+ SourceRange AtEnd;
while (1) {
// If this is a method prototype, parse it.
@@ -359,7 +359,8 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
tok::ObjCKeywordKind DirectiveKind = Tok.getObjCKeywordID();
if (DirectiveKind == tok::objc_end) { // @end -> terminate list
- AtEndLoc = AtLoc;
+ AtEnd.setBegin(AtLoc);
+ AtEnd.setEnd(Tok.getLocation());
break;
}
@@ -422,7 +423,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
// Insert collected methods declarations into the @interface object.
// This passes in an invalid SourceLocation for AtEndLoc when EOF is hit.
- Actions.ActOnAtEnd(AtEndLoc, interfaceDecl,
+ Actions.ActOnAtEnd(AtEnd, interfaceDecl,
allMethods.data(), allMethods.size(),
allProperties.data(), allProperties.size(),
allTUVariables.data(), allTUVariables.size());
@@ -1197,18 +1198,20 @@ Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
return DeclPtrTy();
}
-Parser::DeclPtrTy Parser::ParseObjCAtEndDeclaration(SourceLocation atLoc) {
+Parser::DeclPtrTy Parser::ParseObjCAtEndDeclaration(SourceRange atEnd) {
assert(Tok.isObjCAtKeyword(tok::objc_end) &&
"ParseObjCAtEndDeclaration(): Expected @end");
DeclPtrTy Result = ObjCImpDecl;
ConsumeToken(); // the "end" identifier
if (ObjCImpDecl) {
- Actions.ActOnAtEnd(atLoc, ObjCImpDecl);
+ Actions.ActOnAtEnd(atEnd, ObjCImpDecl);
ObjCImpDecl = DeclPtrTy();
PendingObjCImpDecl.pop_back();
}
- else
- Diag(atLoc, diag::warn_expected_implementation); // missing @implementation
+ else {
+ // missing @implementation
+ Diag(atEnd.getBegin(), diag::warn_expected_implementation);
+ }
return Result;
}
@@ -1216,7 +1219,7 @@ Parser::DeclGroupPtrTy Parser::RetrievePendingObjCImpDecl() {
if (PendingObjCImpDecl.empty())
return Actions.ConvertDeclToDeclGroup(DeclPtrTy());
DeclPtrTy ImpDecl = PendingObjCImpDecl.pop_back_val();
- Actions.ActOnAtEnd(SourceLocation(), ImpDecl);
+ Actions.ActOnAtEnd(SourceRange(), ImpDecl);
return Actions.ConvertDeclToDeclGroup(ImpDecl);
}
OpenPOWER on IntegriCloud