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/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index 4fbbc18..7bf1483 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -275,12 +275,8 @@
}
}
/// Insert collected methods declarations into the @interface object.
- /// This action is executed even if we don't have any methods (so the @end
- /// can be recorded properly).
- Actions.ActOnAddMethodsToObjcDecl(CurScope, interfaceDecl, &allMethods[0],
- allMethods.size(),
- &allProperties[0], allProperties.size(),
- AtEndLoc);
+ Actions.ActOnAtEnd(AtEndLoc, interfaceDecl, &allMethods[0], allMethods.size(),
+ &allProperties[0], allProperties.size());
}
/// Parse property attribute declarations.
@@ -946,12 +942,7 @@
// Checking is not necessary except that a parse error might have caused
// @implementation not to have been parsed to completion and ObjcImpDecl
// could be 0.
- /// Insert collected methods declarations into the @interface object.
- Actions.ActOnAddMethodsToObjcDecl(CurScope, ObjcImpDecl,
- &AllImplMethods[0], AllImplMethods.size(),
- (DeclTy **)0, 0,
- atLoc);
- AllImplMethods.clear();
+ Actions.ActOnAtEnd(atLoc, ObjcImpDecl);
}
return ObjcImpDecl;
@@ -1151,8 +1142,6 @@
void Parser::ParseObjCInstanceMethodDefinition() {
assert(Tok.is(tok::minus) && "Method definitions should start with '-'");
DeclTy *MDecl = ParseObjCMethodPrototype(ObjcImpDecl);
- // FIXME: @optional/@protocol??
- AllImplMethods.push_back(MDecl);
// parse optional ';'
if (Tok.is(tok::semi))
ConsumeToken();
@@ -1169,8 +1158,6 @@
void Parser::ParseObjCClassMethodDefinition() {
assert(Tok.is(tok::plus) && "Class method definitions should start with '+'");
DeclTy *MDecl = ParseObjCMethodPrototype(ObjcImpDecl);
- // FIXME: @optional/@protocol??
- AllImplMethods.push_back(MDecl);
// parse optional ';'
if (Tok.is(tok::semi))
ConsumeToken();