- Remove getInstanceMethods/getClassMethods API on ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCategoryDecl. These methods are replaced by the respective iterators on each class.
- Add getInstanceMethodForSelector to ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCatgoryDecl. This hook will do a "shallow" lookup. This is a convenience method that reducing some of the iterator usage.
- Various changes to convert all clients to the above API's...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45046 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDeclObjC.cpp b/Sema/SemaDeclObjC.cpp
index b2cad37..d520c4f 100644
--- a/Sema/SemaDeclObjC.cpp
+++ b/Sema/SemaDeclObjC.cpp
@@ -452,25 +452,27 @@
const llvm::DenseSet<Selector> &InsMap,
const llvm::DenseSet<Selector> &ClsMap) {
// check unimplemented instance methods.
- ObjcMethodDecl** methods = PDecl->getInstanceMethods();
- for (int j = 0; j < PDecl->getNumInstanceMethods(); j++) {
- if (!InsMap.count(methods[j]->getSelector()) &&
- methods[j]->getImplementationControl() != ObjcMethodDecl::Optional) {
- Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
- methods[j]->getSelector().getName());
+ for (ObjcProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(),
+ E = PDecl->instmeth_end(); I != E; ++I) {
+ ObjcMethodDecl *method = *I;
+ if (!InsMap.count(method->getSelector()) &&
+ method->getImplementationControl() != ObjcMethodDecl::Optional) {
+ Diag(method->getLocation(), diag::warn_undef_method_impl,
+ method->getSelector().getName());
IncompleteImpl = true;
}
}
// check unimplemented class methods
- methods = PDecl->getClassMethods();
- for (int j = 0; j < PDecl->getNumClassMethods(); j++)
- if (!ClsMap.count(methods[j]->getSelector()) &&
- methods[j]->getImplementationControl() != ObjcMethodDecl::Optional) {
- Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
- methods[j]->getSelector().getName());
+ for (ObjcProtocolDecl::classmeth_iterator I = PDecl->classmeth_begin(),
+ E = PDecl->classmeth_end(); I != E; ++I) {
+ ObjcMethodDecl *method = *I;
+ if (!ClsMap.count(method->getSelector()) &&
+ method->getImplementationControl() != ObjcMethodDecl::Optional) {
+ Diag(method->getLocation(), diag::warn_undef_method_impl,
+ method->getSelector().getName());
IncompleteImpl = true;
}
-
+ }
// Check on this protocols's referenced protocols, recursively
ObjcProtocolDecl** RefPDecl = PDecl->getReferencedProtocols();
for (int i = 0; i < PDecl->getNumReferencedProtocols(); i++)
@@ -533,11 +535,11 @@
InsMap.insert((*I)->getSelector());
bool IncompleteImpl = false;
- 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,
- methods[j]->getSelector().getName());
+ for (ObjcCategoryDecl::instmeth_iterator I = CatClassDecl->instmeth_begin(),
+ E = CatClassDecl->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;
@@ -548,11 +550,11 @@
I != E; ++I)
ClsMap.insert((*I)->getSelector());
- methods = CatClassDecl->getClassMethods();
- for (int j = 0; j < CatClassDecl->getNumClassMethods(); j++)
- if (!ClsMap.count(methods[j]->getSelector())) {
- Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
- methods[j]->getSelector().getName());
+ for (ObjcCategoryDecl::classmeth_iterator I = CatClassDecl->classmeth_begin(),
+ E = CatClassDecl->classmeth_end(); I != E; ++I)
+ if (!ClsMap.count((*I)->getSelector())) {
+ Diag((*I)->getLocation(), diag::warn_undef_method_impl,
+ (*I)->getSelector().getName());
IncompleteImpl = true;
}