objective-C: refactoring of objc's delayed parsing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161620 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 69e6d0a..70254b6 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -2864,7 +2864,6 @@
   ConsumeAnyToken();
     
   assert(Tok.is(tok::l_brace) && "Inline objective-c method not starting with '{'");
-  SourceLocation BraceLoc = Tok.getLocation();
   // Enter a scope for the method or c-fucntion body.
   ParseScope BodyScope(this,
                        parseMethod
@@ -2877,27 +2876,9 @@
     Actions.ActOnStartOfObjCMethodDef(getCurScope(), MCDecl);
   else
     Actions.ActOnStartOfFunctionDef(getCurScope(), MCDecl);
-    
-  if (SkipFunctionBodies && trySkippingFunctionBody()) {
-    BodyScope.Exit();
-    (void)Actions.ActOnFinishFunctionBody(MCDecl, 0);
-    return;
-  }
-    
-  StmtResult FnBody(ParseCompoundStatementBody());
-    
-  // If the function body could not be parsed, make a bogus compoundstmt.
-  if (FnBody.isInvalid()) {
-    Sema::CompoundScopeRAII CompoundScope(Actions);
-    FnBody = Actions.ActOnCompoundStmt(BraceLoc, BraceLoc,
-                                       MultiStmtArg(Actions), false);
-  }
-    
-  // Leave the function body scope.
-  BodyScope.Exit();
-    
-  (void)Actions.ActOnFinishFunctionBody(MCDecl, FnBody.take());
-
+  
+  MCDecl = ParseFunctionStatementBody(MCDecl, BodyScope);
+  
   if (Tok.getLocation() != OrigLoc) {
     // Due to parsing error, we either went over the cached tokens or
     // there are still cached tokens left. If it's the latter case skip the