Move the "current scope" state from the Parser into Action. This
allows Sema some limited access to the current scope, which we only
use in one way: when Sema is performing some kind of declaration that
is not directly driven by the parser (e.g., due to template
instantiatio or lazy declaration of a member), we can find the Scope
associated with a DeclContext, if that DeclContext is still in the
process of being parsed. 

Use this to make the implicit declaration of special member functions
in a C++ class more "scope-less", rather than using the NULL Scope hack.

llvm-svn: 107491
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index 64306da..1713a4f 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/lib/Parse/ParseTemplate.cpp
@@ -201,7 +201,7 @@
 
   if (Tok.is(tok::semi)) {
     DeclEnd = ConsumeToken();
-    DeclPtrTy Decl = Actions.ParsedFreeStandingDeclSpec(CurScope, AS, DS);
+    DeclPtrTy Decl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
     DS.complete(Decl);
     return Decl;
   }
@@ -481,7 +481,7 @@
     DefaultArg = ParseTypeName().get();
   }
   
-  return Actions.ActOnTypeParameter(CurScope, TypenameKeyword, Ellipsis, 
+  return Actions.ActOnTypeParameter(getCurScope(), TypenameKeyword, Ellipsis, 
                                     EllipsisLoc, KeyLoc, ParamName, NameLoc,
                                     Depth, Position, EqualLoc, DefaultArg);
 }
@@ -556,7 +556,7 @@
     }
   }
   
-  return Actions.ActOnTemplateTemplateParameter(CurScope, TemplateLoc,
+  return Actions.ActOnTemplateTemplateParameter(getCurScope(), TemplateLoc,
                                                 ParamList, ParamName,
                                                 NameLoc, Depth, Position,
                                                 EqualLoc, DefaultArg);
@@ -612,7 +612,7 @@
   }
 
   // Create the parameter.
-  return Actions.ActOnNonTypeTemplateParameter(CurScope, ParamDecl, 
+  return Actions.ActOnNonTypeTemplateParameter(getCurScope(), ParamDecl, 
                                                Depth, Position, EqualLoc, 
                                                move(DefaultArg));
 }
@@ -906,7 +906,7 @@
       // template argument.
       TemplateTy Template;
       if (isEndOfTemplateArgument(Tok) &&
-          Actions.ActOnDependentTemplateName(CurScope, TemplateLoc, SS, Name, 
+          Actions.ActOnDependentTemplateName(getCurScope(), TemplateLoc, SS, Name, 
                                              /*ObjectType=*/0,
                                              /*EnteringContext=*/false,
                                              Template))
@@ -921,7 +921,7 @@
     
     if (isEndOfTemplateArgument(Tok)) {
       bool MemberOfUnknownSpecialization;
-      TemplateNameKind TNK = Actions.isTemplateName(CurScope, SS, Name, 
+      TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS, Name, 
                                                     /*ObjectType=*/0, 
                                                     /*EnteringContext=*/false, 
                                                     Template,