diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-04-27 13:50:30 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-04-27 13:50:30 +0000 |
commit | 2d1c5d313cd0c229cc614e74baa4c5756a4b46f4 (patch) | |
tree | 7d70bf13b88e07d74c70202bf6c6fd4e10dea312 /lib/Parse/ParseDeclCXX.cpp | |
parent | 642e38baaeedb1a35c36df02a1ac57002a43a694 (diff) |
Parsing of namespaces:
-NamespaceDecl for the AST
-Checks for name clashes between namespaces and tag/normal declarations.
This commit doesn't implement proper name lookup for namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 04cd254193..5d49f4dd59 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -62,17 +62,25 @@ Parser::DeclTy *Parser::ParseNamespace(unsigned Context) { // FIXME: Verify no attributes were present. // FIXME: parse this. } else if (Tok.is(tok::l_brace)) { + SourceLocation LBrace = ConsumeBrace(); - // FIXME: push a scope, push a namespace decl. - - while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) { - // FIXME capture the decls. + + // Enter a scope for the namespace. + EnterScope(Scope::DeclScope); + + DeclTy *NamespcDecl = + Actions.ActOnStartNamespaceDef(CurScope, IdentLoc, Ident, LBrace); + + while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) ParseExternalDeclaration(); - } SourceLocation RBrace = MatchRHSPunctuation(tok::r_brace, LBrace); + Actions.ActOnFinishNamespaceDef(NamespcDecl, RBrace); + + ExitScope(); + + return NamespcDecl; - // FIXME: act on this. } else { unsigned D = Ident ? diag::err_expected_lbrace : diag::err_expected_ident_lbrace; |