]> granicus.if.org Git - clang/commitdiff
Fix Parser::ParseObjCMethodDefinition(). Only call the actions module for valid MDecl's.
authorSteve Naroff <snaroff@apple.com>
Fri, 25 Jul 2008 14:30:25 +0000 (14:30 +0000)
committerSteve Naroff <snaroff@apple.com>
Fri, 25 Jul 2008 14:30:25 +0000 (14:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54013 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp

index 7d7ba10a38bff86ffbe1af0ccf13cc47138eac8b..38379b14e6b50056e24416cb45a8d17e59be8fb0 100644 (file)
@@ -1292,8 +1292,10 @@ Parser::DeclTy *Parser::ParseObjCMethodDefinition() {
   EnterScope(Scope::FnScope|Scope::DeclScope);
   
   // Tell the actions module that we have entered a method definition with the
-  // specified Declarator for the method.
-  Actions.ObjCActOnStartOfMethodDef(CurScope, MDecl);
+  // specified Declarator for the method. If we don't have an MDecl, avoid
+  // calling the actions module.
+  if (MDecl)
+    Actions.ObjCActOnStartOfMethodDef(CurScope, MDecl);
   
   StmtResult FnBody = ParseCompoundStatementBody();
   
@@ -1305,7 +1307,8 @@ Parser::DeclTy *Parser::ParseObjCMethodDefinition() {
   ExitScope();
   
   // TODO: Pass argument information.
-  Actions.ActOnFinishFunctionBody(MDecl, FnBody.Val);
+  if (MDecl)
+    Actions.ActOnFinishFunctionBody(MDecl, FnBody.Val);
   return MDecl;
 }