aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-12 17:58:05 +0000
committerChris Lattner <sabre@nondot.org>2007-12-12 17:58:05 +0000
commit4c52509ffb9fdd6c93aa7b50812e316f1d920a26 (patch)
tree854025269247415e86e6d1c6791371be4d94cb19
parent33ef2590b982c626e5c645a97f8e4ca160cd8f98 (diff)
unbreak the build. I'm still working on test failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44938 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Sema/SemaDeclObjC.cpp63
-rw-r--r--clang.xcodeproj/project.pbxproj1
-rw-r--r--include/clang/AST/DeclObjC.h12
3 files changed, 44 insertions, 32 deletions
diff --git a/Sema/SemaDeclObjC.cpp b/Sema/SemaDeclObjC.cpp
index 5b5b36d06d..376e8e6fe7 100644
--- a/Sema/SemaDeclObjC.cpp
+++ b/Sema/SemaDeclObjC.cpp
@@ -413,13 +413,13 @@ void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl,
// Check interface's Ivar list against those in the implementation.
// names and types must match.
//
- ObjcIvarDecl** IntfIvars = IDecl->getInstanceVariables();
- int IntfNumIvars = IDecl->getNumInstanceVariables();
unsigned j = 0;
bool err = false;
- while (numIvars > 0 && IntfNumIvars > 0) {
+ ObjcInterfaceDecl::ivar_iterator
+ IVI = IDecl->ivar_begin(), IVE = IDecl->ivar_end();
+ for (; numIvars > 0 && IVI != IVE; ++IVI) {
ObjcIvarDecl* ImplIvar = ivars[j];
- ObjcIvarDecl* ClsIvar = IntfIvars[j++];
+ ObjcIvarDecl* ClsIvar = *IVI;
assert (ImplIvar && "missing implementation ivar");
assert (ClsIvar && "missing class ivar");
if (ImplIvar->getCanonicalType() != ClsIvar->getCanonicalType()) {
@@ -439,10 +439,9 @@ void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl,
break;
}
--numIvars;
- --IntfNumIvars;
}
- if (!err && (numIvars > 0 || IntfNumIvars > 0))
- Diag(numIvars > 0 ? ivars[j]->getLocation() : IntfIvars[j]->getLocation(),
+ if (!err && (numIvars > 0 || IVI != IVE))
+ Diag(numIvars > 0 ? ivars[j]->getLocation() : (*IVI)->getLocation(),
diag::err_inconsistant_ivar);
}
@@ -484,30 +483,31 @@ void Sema::ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl,
llvm::DenseSet<Selector> InsMap;
// Check and see if instance methods in class interface have been
// implemented in the implementation class.
- ObjcMethodDecl *const*methods = IMPDecl->getInstanceMethods();
- for (int i=0; i < IMPDecl->getNumInstanceMethods(); i++)
- InsMap.insert(methods[i]->getSelector());
+ for (ObjcImplementationDecl::instmeth_iterator I = IMPDecl->instmeth_begin(),
+ E = IMPDecl->instmeth_end(); I != E; ++I)
+ InsMap.insert((*I)->getSelector());
bool IncompleteImpl = false;
- methods = IDecl->getInstanceMethods();
- for (int j = 0; j < IDecl->getNumInstanceMethods(); j++)
- if (!InsMap.count(methods[j]->getSelector())) {
- Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
- methods[j]->getSelector().getName());
+ for (ObjcInterfaceDecl::instmeth_iterator I = IDecl->instmeth_begin(),
+ E = IDecl->instmeth_end(); I != E; ++I)
+ if (!InsMap.count((*I)->getSelector())) {
+ Diag((*I)->getLocation(), diag::warn_undef_method_impl,
+ (*I)->getSelector().getName());
IncompleteImpl = true;
}
+
llvm::DenseSet<Selector> ClsMap;
// Check and see if class methods in class interface have been
// implemented in the implementation class.
- methods = IMPDecl->getClassMethods();
- for (int i=0; i < IMPDecl->getNumClassMethods(); i++)
- ClsMap.insert(methods[i]->getSelector());
-
- methods = IDecl->getClassMethods();
- for (int j = 0; j < IDecl->getNumClassMethods(); j++)
- if (!ClsMap.count(methods[j]->getSelector())) {
- Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
- methods[j]->getSelector().getName());
+ for (ObjcImplementationDecl::classmeth_iterator I =IMPDecl->classmeth_begin(),
+ E = IMPDecl->classmeth_end(); I != E; ++I)
+ ClsMap.insert((*I)->getSelector());
+
+ for (ObjcInterfaceDecl::classmeth_iterator I = IDecl->classmeth_begin(),
+ E = IDecl->classmeth_end(); I != E; ++I)
+ if (!ClsMap.count((*I)->getSelector())) {
+ Diag((*I)->getLocation(), diag::warn_undef_method_impl,
+ (*I)->getSelector().getName());
IncompleteImpl = true;
}
@@ -529,12 +529,12 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl,
llvm::DenseSet<Selector> InsMap;
// Check and see if instance methods in category interface have been
// implemented in its implementation class.
- ObjcMethodDecl *const*methods = CatImplDecl->getInstanceMethods();
- for (int i=0; i < CatImplDecl->getNumInstanceMethods(); i++)
- InsMap.insert(methods[i]->getSelector());
+ for (ObjcCategoryImplDecl::instmeth_iterator I =CatImplDecl->instmeth_begin(),
+ E = CatImplDecl->instmeth_end(); I != E; ++I)
+ InsMap.insert((*I)->getSelector());
bool IncompleteImpl = false;
- methods = CatClassDecl->getInstanceMethods();
+ ObjcMethodDecl *const* methods = CatClassDecl->getInstanceMethods();
for (int j = 0; j < CatClassDecl->getNumInstanceMethods(); j++)
if (!InsMap.count(methods[j]->getSelector())) {
Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
@@ -544,9 +544,10 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl,
llvm::DenseSet<Selector> ClsMap;
// Check and see if class methods in category interface have been
// implemented in its implementation class.
- methods = CatImplDecl->getClassMethods();
- for (int i=0; i < CatImplDecl->getNumClassMethods(); i++)
- ClsMap.insert(methods[i]->getSelector());
+ for (ObjcCategoryImplDecl::classmeth_iterator
+ I = CatImplDecl->classmeth_begin(), E = CatImplDecl->classmeth_end();
+ I != E; ++I)
+ ClsMap.insert((*I)->getSelector());
methods = CatClassDecl->getClassMethods();
for (int j = 0; j < CatClassDecl->getNumClassMethods(); j++)
diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj
index 0b2d9fabb0..45276f149b 100644
--- a/clang.xcodeproj/project.pbxproj
+++ b/clang.xcodeproj/project.pbxproj
@@ -775,7 +775,6 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
projectDirPath = "";
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index a1b73cd4ee..48722d7efd 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -123,6 +123,18 @@ public:
ObjcMethodDecl** getClassMethods() const { return ClassMethods; }
int getNumClassMethods() const { return NumClassMethods; }
+ typedef ObjcMethodDecl * const * instmeth_iterator;
+ instmeth_iterator instmeth_begin() const { return InstanceMethods; }
+ instmeth_iterator instmeth_end() const {
+ return InstanceMethods+NumInstanceMethods;
+ }
+
+ typedef ObjcMethodDecl * const * classmeth_iterator;
+ classmeth_iterator classmeth_begin() const { return ClassMethods; }
+ classmeth_iterator classmeth_end() const {
+ return ClassMethods+NumClassMethods;
+ }
+
void addInstanceVariablesToClass(ObjcIvarDecl **ivars, unsigned numIvars,
SourceLocation RBracLoc);