Use a scoped object to manage entry/exit from a parser scope rather than explicitly calling EnterScope/ExitScope

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60830 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index 2f5014b..824847a 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -65,7 +65,7 @@
 /// (non-nested) C++ class. Now go over the stack of lexed methods that were
 /// collected during its parsing and parse them all.
 void Parser::ParseLexedMethodDefs() {
-  while (!getCurTopClassStack().empty()) {
+  for (; !getCurTopClassStack().empty(); getCurTopClassStack().pop()) {
     LexedMethod &LM = getCurTopClassStack().top();
 
     assert(!LM.Toks.empty() && "Empty body!");
@@ -81,15 +81,13 @@
 
     // Parse the method body. Function body parsing code is similar enough
     // to be re-used for method bodies as well.
-    EnterScope(Scope::FnScope|Scope::DeclScope);
+    ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope);
     Actions.ActOnStartOfFunctionDef(CurScope, LM.D);
 
     if (Tok.is(tok::colon))
       ParseConstructorInitializer(LM.D);
 
     ParseFunctionStatementBody(LM.D, Tok.getLocation(), Tok.getLocation());
-
-    getCurTopClassStack().pop();
   }
 }