Handle parsing of templates in member declarations. Pass the AccessSpecifier all the way down to ActOnClassTemplate.

Doug, Sebastian: Plz review! :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67723 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 1bbf411..61182ef 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -460,7 +460,8 @@
                                                  Attr,
                        Action::MultiTemplateParamsArg(Actions, 
                                                       &(*TemplateParams)[0],
-                                                      TemplateParams->size()));
+                                                      TemplateParams->size()),
+                                                 AS);
   else
     TagOrTempResult = Actions.ActOnTag(CurScope, TagType, TK, StartLoc, SS, Name, 
                                        NameLoc, Attr, AS);
@@ -615,7 +616,7 @@
 ///         ::[opt] nested-name-specifier template[opt] unqualified-id ';'[TODO]
 ///         using-declaration                                            [TODO]
 /// [C++0x] static_assert-declaration
-///         template-declaration                                         [TODO]
+///         template-declaration
 /// [GNU]   '__extension__' member-declaration
 ///
 ///       member-declarator-list:
@@ -638,6 +639,10 @@
   if (Tok.is(tok::kw_static_assert))
     return ParseStaticAssertDeclaration();
       
+  if (Tok.is(tok::kw_template))
+    return ParseTemplateDeclarationOrSpecialization(Declarator::MemberContext,
+                                                    AS);
+
   // Handle:  member-declaration ::= '__extension__' member-declaration
   if (Tok.is(tok::kw___extension__)) {
     // __extension__ silences extension warnings in the subexpression.
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index 2aeb182..2c07823 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -35,7 +35,8 @@
 ///       explicit-specialization: [ C++ temp.expl.spec]
 ///         'template' '<' '>' declaration
 Parser::DeclTy *
-Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context) {
+Parser::ParseTemplateDeclarationOrSpecialization(unsigned Context,
+                                                 AccessSpecifier AS) {
   assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) && 
 	 "Token does not start a template declaration.");
   
@@ -94,7 +95,7 @@
   } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template));
 
   // Parse the actual template declaration.
-  return ParseDeclarationOrFunctionDefinition(&ParamLists);
+  return ParseDeclarationOrFunctionDefinition(&ParamLists, AS);
 }
 
 /// ParseTemplateParameters - Parses a template-parameter-list enclosed in
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 135faf4..7a221d0 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -442,10 +442,11 @@
 ///
 Parser::DeclTy *
 Parser::ParseDeclarationOrFunctionDefinition(
-                                  TemplateParameterLists *TemplateParams) {
+                                  TemplateParameterLists *TemplateParams,
+                                  AccessSpecifier AS) {
   // Parse the common declaration-specifiers piece.
   DeclSpec DS;
-  ParseDeclarationSpecifiers(DS, TemplateParams);
+  ParseDeclarationSpecifiers(DS, TemplateParams, AS);
 
   // C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
   // declaration-specifiers init-declarator-list[opt] ';'