diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-30 03:27:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-30 03:27:21 +0000 |
commit | d7c4d984d03d81e8bbdd57c4bca260f575985858 (patch) | |
tree | 2cfcc8d1b7cd75f1443afc69890b20e07651bdc2 /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | 03f2af79b84fab0858bb8d09e49293addb0fe601 (diff) | |
download | bcm5719-llvm-d7c4d984d03d81e8bbdd57c4bca260f575985858.tar.gz bcm5719-llvm-d7c4d984d03d81e8bbdd57c4bca260f575985858.zip |
Parser support for C++ using directives, from Piotr Rak
llvm-svn: 61486
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 5ba2850a3f0..e3c8373723e 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1349,6 +1349,34 @@ void Sema::ActOnFinishNamespaceDef(DeclTy *D, SourceLocation RBrace) { PopDeclContext(); } +Sema::DeclTy *Sema::ActOnUsingDirective(Scope *S, + SourceLocation UsingLoc, + SourceLocation NamespcLoc, + const CXXScopeSpec &SS, + SourceLocation IdentLoc, + IdentifierInfo *NamespcName, + AttributeList *AttrList) { + assert(!SS.isInvalid() && "Invalid CXXScopeSpec."); + assert(NamespcName && "Invalid NamespcName."); + assert(IdentLoc.isValid() && "Invalid NamespceName location."); + + // FIXME: This still requires lot more checks, and AST support. + // Lookup namespace name. + DeclContext *DC = static_cast<DeclContext*>(SS.getScopeRep()); + Decl *NS = 0; + + if ((NS = LookupNamespaceName(NamespcName, S, DC))) { + assert(isa<NamespaceDecl>(NS) && "expected namespace decl"); + } else { + DiagnosticBuilder Builder = Diag(IdentLoc, diag::err_expected_namespace_name); + if (SS.isSet()) + Builder << SS.getRange(); + } + + // FIXME: We ignore AttrList for now, and delete it to avoid leak. + delete AttrList; + return 0; +} /// AddCXXDirectInitializerToDecl - This action is called immediately after /// ActOnDeclarator, when a C++ direct initializer is present. |