summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
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/Sema/SemaDeclObjC.cpp
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/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 179255aedf9..f2fc1f4f56d 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1612,7 +1612,8 @@ void Sema::CompareMethodParamsInBaseAndSuper(Decl *ClassDecl,
// Note: For class/category implemenations, allMethods/allProperties is
// always null.
-void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl,
+void Sema::ActOnAtEnd(SourceRange AtEnd,
+ DeclPtrTy classDecl,
DeclPtrTy *allMethods, unsigned allNum,
DeclPtrTy *allProperties, unsigned pNum,
DeclGroupPtrTy *allTUVars, unsigned tuvNum) {
@@ -1629,9 +1630,13 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl,
|| isa<ObjCProtocolDecl>(ClassDecl);
bool checkIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
- if (!isInterfaceDeclKind && AtEndLoc.isInvalid()) {
- AtEndLoc = ClassDecl->getLocation();
- Diag(AtEndLoc, diag::warn_missing_atend);
+ if (!isInterfaceDeclKind && AtEnd.isInvalid()) {
+ // FIXME: This is wrong. We shouldn't be pretending that there is
+ // an '@end' in the declaration.
+ SourceLocation L = ClassDecl->getLocation();
+ AtEnd.setBegin(L);
+ AtEnd.setEnd(L);
+ Diag(L, diag::warn_missing_atend);
}
DeclContext *DC = dyn_cast<DeclContext>(ClassDecl);
@@ -1708,17 +1713,17 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl,
E = CDecl->prop_end();
I != E; ++I)
ProcessPropertyDecl(*I, CDecl);
- CDecl->setAtEndLoc(AtEndLoc);
+ CDecl->setAtEndRange(AtEnd);
}
if (ObjCImplementationDecl *IC=dyn_cast<ObjCImplementationDecl>(ClassDecl)) {
- IC->setAtEndLoc(AtEndLoc);
+ IC->setAtEndRange(AtEnd);
if (ObjCInterfaceDecl* IDecl = IC->getClassInterface()) {
ImplMethodsVsClassMethods(IC, IDecl);
AtomicPropertySetterGetterRules(IC, IDecl);
}
} else if (ObjCCategoryImplDecl* CatImplClass =
dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
- CatImplClass->setAtEndLoc(AtEndLoc);
+ CatImplClass->setAtEndRange(AtEnd);
// Find category interface decl and then check that all methods declared
// in this interface are implemented in the category @implementation.
OpenPOWER on IntegriCloud