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/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index c1120d5..d21dc4a 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -41,7 +41,7 @@
   SourceLocation TemplateLoc = ConsumeToken();
   
   // Enter template-parameter scope.
-  EnterScope(Scope::TemplateParamScope);
+  ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
 
   // Try to parse the template parameters, and the declaration if
   // successful.
@@ -49,9 +49,6 @@
   if(ParseTemplateParameters(0))
     TemplateDecl = ParseDeclarationOrFunctionDefinition();
 
-  // Leave template-parameter scope.
-  ExitScope();
-
   return TemplateDecl;
 }