diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-03 19:21:40 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-03 19:21:40 +0000 |
commit | 2a3009a432bdcec59e6383d7b2b17494d6f91649 (patch) | |
tree | 6f72140cec82a050b33451ebcda7f762e90234e2 /lib/AST/Decl.cpp | |
parent | 89c9d8e7f0700d27b1d93dc3832eb1af9b92c221 (diff) |
Semantic analysis, ASTs, and unqualified name lookup support for C++
using directives, from Piotr Rak!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63646 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 0a3801a78f..6bc02e0a97 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "clang/AST/Decl.h" +#include "clang/AST/DeclCXX.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Stmt.h" #include "clang/AST/Expr.h" @@ -146,6 +147,13 @@ FileScopeAsmDecl *FileScopeAsmDecl::Create(ASTContext &C, DeclContext *DC, bool NamedDecl::declarationReplaces(NamedDecl *OldD) const { assert(getDeclName() == OldD->getDeclName() && "Declaration name mismatch"); + // UsingDirectiveDecl's are not really NamedDecl's, and all have same name. + // We want to keep it, unless it nominates same namespace. + if (getKind() == Decl::UsingDirective) { + return cast<UsingDirectiveDecl>(this)->getNominatedNamespace() == + cast<UsingDirectiveDecl>(OldD)->getNominatedNamespace(); + } + if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this)) // For function declarations, we keep track of redeclarations. return FD->getPreviousDeclaration() == OldD; |