From: Anders Carlsson Date: Sat, 28 Mar 2009 05:27:17 +0000 (+0000) Subject: Add an ActOnNamespaceAliasDef action and have the parser call it. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbb0094f441d2f15dd6eee581e1569244a26009f;p=clang Add an ActOnNamespaceAliasDef action and have the parser call it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67915 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index f284ca0a75..2f4d283950 100644 --- a/include/clang/Parse/Action.h +++ b/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/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 229c1815f2..121bf04bc3 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/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/lib/Sema/Sema.h b/lib/Sema/Sema.h index 37a1799898..ab845595b1 100644 --- a/lib/Sema/Sema.h +++ b/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/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 90983040b5..349aafdbda 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/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);"