Fix <rdar://problem/6636803> [sema] crash on InterfaceBuilder.

Parser::ParseObjCMethodDefinition(): Make sure we don't exit the BodyScope until ActOnFinishFunctionBody() is complete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65880 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 3aa525b..193a73f 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1386,11 +1386,12 @@
     FnBody = Actions.ActOnCompoundStmt(BraceLoc, BraceLoc,
                                        MultiStmtArg(Actions), false);
 
+  // TODO: Pass argument information.
+  Actions.ActOnFinishFunctionBody(MDecl, move(FnBody));
+  
   // Leave the function body scope.
   BodyScope.Exit();
 
-  // TODO: Pass argument information.
-  Actions.ActOnFinishFunctionBody(MDecl, move(FnBody));
   return MDecl;
 }