This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() about private methods (r43989).
While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end).
Other details...
- Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments.
- Removed Parser::AllImplMethods (a nice cleanup).
- Added location info to ObjcImplementationDecl (since we will need it very soon:-)
- Modified message.m test to no longer allow the bogus diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43995 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index 2e79de3..584fbf5 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -408,26 +408,6 @@
}
}
-/// ObjcAddImplMethods - Insert instance and methods declarations into
-/// ObjcImplementationDecl's InsMethods and ClsMethods fields.
-///
-void ObjcImplementationDecl::addMethods(ObjcMethodDecl **insMethods,
- unsigned numInsMembers,
- ObjcMethodDecl **clsMethods,
- unsigned numClsMembers,
- SourceLocation AtEndLoc) {
- NumInstanceMethods = numInsMembers;
- if (numInsMembers) {
- InstanceMethods = new ObjcMethodDecl*[numInsMembers];
- memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*));
- }
- NumClassMethods = numClsMembers;
- if (numClsMembers) {
- ClassMethods = new ObjcMethodDecl*[numClsMembers];
- memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*));
- }
-}
-
// lookupInstanceMethod - This method returns an instance method by looking in
// the class, it's categories, and it's super classes (using a linear search).
ObjcMethodDecl *ObjcInterfaceDecl::lookupInstanceMethod(Selector &Sel) {
@@ -514,7 +494,7 @@
// the class implementation. Unlike interfaces, we don't look outside the
// implementation.
ObjcMethodDecl *ObjcImplementationDecl::lookupInstanceMethod(Selector &Sel) {
- ObjcMethodDecl **methods = getInstanceMethods();
+ ObjcMethodDecl *const*methods = getInstanceMethods();
int methodCount = getNumInstanceMethods();
for (int i = 0; i < methodCount; ++i) {
if (methods[i]->getSelector() == Sel) {
@@ -528,7 +508,7 @@
// the class implementation. Unlike interfaces, we don't look outside the
// implementation.
ObjcMethodDecl *ObjcImplementationDecl::lookupClassMethod(Selector &Sel) {
- ObjcMethodDecl **methods = getClassMethods();
+ ObjcMethodDecl *const*methods = getClassMethods();
int methodCount = getNumClassMethods();
for (int i = 0; i < methodCount; ++i) {
if (methods[i]->getSelector() == Sel) {