From 9205d553901199becb389fd59d8d944af654e2df Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 28 Mar 2009 05:27:17 +0000 Subject: [PATCH] Add an ActOnNamespaceAliasDef action and have the parser call it. llvm-svn: 67915 --- clang/include/clang/Parse/Action.h | 11 +++++++++++ clang/lib/Parse/ParseDeclCXX.cpp | 3 ++- clang/lib/Sema/Sema.h | 9 ++++++++- clang/lib/Sema/SemaDeclCXX.cpp | 9 +++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h index f284ca0a7544..2f4d283950b6 100644 --- a/clang/include/clang/Parse/Action.h +++ b/clang/include/clang/Parse/Action.h @@ -842,6 +842,17 @@ public: IdentifierInfo *NamespcName, AttributeList *AttrList); + /// ActOnNamespaceAliasDef - This is called when a namespace alias definition + /// is parsed. + virtual DeclTy *ActOnNamespaceAliasDef(Scope *CurScope, + SourceLocation AliasLoc, + IdentifierInfo *Alias, + const CXXScopeSpec &SS, + SourceLocation NamespaceLoc, + IdentifierInfo *NamespaceName) { + return 0; + } + /// ActOnParamDefaultArgument - Parse default argument for function parameter virtual void ActOnParamDefaultArgument(DeclTy *param, SourceLocation EqualLoc, diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 229c1815f25a..121bf04bc33c 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -124,7 +124,8 @@ Parser::DeclTy *Parser::ParseNamespaceAlias(SourceLocation AliasLoc, ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "namespace name", tok::semi); - return 0; + return Actions.ActOnNamespaceAliasDef(CurScope, AliasLoc, Alias, SS, + NamespaceLoc, NamespaceName); } /// ParseLinkage - We know that the current token is a string_literal diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 37a1799898b1..ab845595b1eb 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -1370,9 +1370,16 @@ public: SourceLocation IdentLoc, IdentifierInfo *NamespcName, AttributeList *AttrList); - + void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir); + virtual DeclTy *ActOnNamespaceAliasDef(Scope *CurScope, + SourceLocation AliasLoc, + IdentifierInfo *Alias, + const CXXScopeSpec &SS, + SourceLocation NamespaceLoc, + IdentifierInfo *NamespaceName); + /// AddCXXDirectInitializerToDecl - This action is called immediately after /// ActOnDeclarator, when a C++ direct initializer is present. /// e.g: "int x(1);" diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 90983040b5b4..349aafdbda57 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1675,6 +1675,15 @@ void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) { S->PushUsingDirective(UDir); } +Sema::DeclTy *Sema::ActOnNamespaceAliasDef(Scope *CurScope, + SourceLocation AliasLoc, + IdentifierInfo *Alias, + const CXXScopeSpec &SS, + SourceLocation NamespaceLoc, + IdentifierInfo *NamespaceName) { + return 0; +} + /// AddCXXDirectInitializerToDecl - This action is called immediately after /// ActOnDeclarator, when a C++ direct initializer is present. /// e.g: "int x(1);"