First patch toward rewriting of method definitions. This is work in progress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43915 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index a149b86..1f38c23 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -1146,38 +1146,37 @@
/// objc-method-def: objc-method-proto ';'[opt] '{' body '}'
///
-void Parser::ParseObjCInstanceMethodDefinition() {
+Parser::DeclTy *Parser::ParseObjCInstanceMethodDefinition() {
assert(Tok.is(tok::minus) && "Method definitions should start with '-'");
-
+ DeclTy *MDecl = ParseObjCMethodPrototype(ObjcImpDecl);
// FIXME: @optional/@protocol??
- AllImplMethods.push_back(ParseObjCMethodPrototype(ObjcImpDecl));
+ AllImplMethods.push_back(MDecl);
// parse optional ';'
if (Tok.is(tok::semi))
ConsumeToken();
if (Tok.isNot(tok::l_brace)) {
Diag (Tok, diag::err_expected_lbrace);
- return;
+ return 0;
}
-
- StmtResult FnBody = ParseCompoundStatementBody();
+ return ObjcParseFunctionDefinition(MDecl);
}
/// objc-method-def: objc-method-proto ';'[opt] '{' body '}'
///
-void Parser::ParseObjCClassMethodDefinition() {
+Parser::DeclTy *Parser::ParseObjCClassMethodDefinition() {
assert(Tok.is(tok::plus) && "Class method definitions should start with '+'");
+ DeclTy *MDecl = ParseObjCMethodPrototype(ObjcImpDecl);
// FIXME: @optional/@protocol??
- AllImplMethods.push_back(ParseObjCMethodPrototype(ObjcImpDecl));
+ AllImplMethods.push_back(MDecl);
// parse optional ';'
if (Tok.is(tok::semi))
ConsumeToken();
if (Tok.isNot(tok::l_brace)) {
Diag (Tok, diag::err_expected_lbrace);
- return;
+ return 0;
}
-
- StmtResult FnBody = ParseCompoundStatementBody();
+ return ObjcParseFunctionDefinition(MDecl);
}
Parser::ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {