refactor enough of the top-level parsing logic to parse and
ignore 'namespace foo {}'



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41400 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp
index e5c5bb9..d1dde24 100644
--- a/Parse/ParseDecl.cpp
+++ b/Parse/ParseDecl.cpp
@@ -190,7 +190,28 @@
 /// ParseDeclaration - Parse a full 'declaration', which consists of
 /// declaration-specifiers, some number of declarators, and a semicolon.
 /// 'Context' should be a Declarator::TheContext value.
+///
+///       declaration: [C99 6.7]
+///         block-declaration ->
+///           simple-declaration
+///           others                   [FIXME]
+/// [C++]   namespace-definition
+///         others... [FIXME]
+///
 Parser::DeclTy *Parser::ParseDeclaration(unsigned Context) {
+  switch (Tok.getKind()) {
+  case tok::kw_namespace:
+    return ParseNamespace(Context);
+  default:
+    return ParseSimpleDeclaration(Context);
+  }
+}
+
+///       simple-declaration: [C99 6.7: declaration] [C++ 7p1: dcl.dcl]
+///         declaration-specifiers init-declarator-list[opt] ';'
+///[C90/C++]init-declarator-list ';'                             [TODO]
+/// [OMP]   threadprivate-directive                              [TODO]
+Parser::DeclTy *Parser::ParseSimpleDeclaration(unsigned Context) {
   // Parse the common declaration-specifiers piece.
   DeclSpec DS;
   ParseDeclarationSpecifiers(DS);
@@ -208,16 +229,12 @@
   return ParseInitDeclaratorListAfterFirstDeclarator(DeclaratorInfo);
 }
 
+
 /// ParseInitDeclaratorListAfterFirstDeclarator - Parse 'declaration' after
 /// parsing 'declaration-specifiers declarator'.  This method is split out this
 /// way to handle the ambiguity between top-level function-definitions and
 /// declarations.
 ///
-///       declaration: [C99 6.7]
-///         declaration-specifiers init-declarator-list[opt] ';' [TODO]
-/// [!C99]  init-declarator-list ';'                             [TODO]
-/// [OMP]   threadprivate-directive                              [TODO]
-///
 ///       init-declarator-list: [C99 6.7]
 ///         init-declarator
 ///         init-declarator-list ',' init-declarator