Take 2: Use an artifical namespace so that member vars do not hide local vars.
Summary: This relands r259810 with fix for failures on Mac.
Reviewers: spyffe, tfiala
Subscribers: tfiala, lldb-commits
Differential Revision: http://reviews.llvm.org/D16900
llvm-svn: 259902
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 0fc1a94..f953ddb 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1885,6 +1885,17 @@
return namespace_decl;
}
+NamespaceDecl *
+ClangASTContext::GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
+ const char *name,
+ clang::DeclContext *decl_ctx)
+{
+ ClangASTContext *ast_ctx = ClangASTContext::GetASTContext(ast);
+ if (ast_ctx == nullptr)
+ return nullptr;
+
+ return ast_ctx->GetUniqueNamespaceDeclaration(name, decl_ctx);
+}
clang::BlockDecl *
ClangASTContext::CreateBlockDeclaration (clang::DeclContext *ctx)
@@ -9781,7 +9792,9 @@
//----------------------------------------------------------------------
std::vector<CompilerDecl>
-ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name)
+ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx,
+ ConstString name,
+ const bool ignore_using_decls)
{
std::vector<CompilerDecl> found_decls;
if (opaque_decl_ctx)
@@ -9805,12 +9818,16 @@
{
if (clang::UsingDirectiveDecl *ud = llvm::dyn_cast<clang::UsingDirectiveDecl>(child))
{
+ if (ignore_using_decls)
+ continue;
clang::DeclContext *from = ud->getCommonAncestor();
if (searched.find(ud->getNominatedNamespace()) == searched.end())
search_queue.insert(std::make_pair(from, ud->getNominatedNamespace()));
}
else if (clang::UsingDecl *ud = llvm::dyn_cast<clang::UsingDecl>(child))
{
+ if (ignore_using_decls)
+ continue;
for (clang::UsingShadowDecl *usd : ud->shadows())
{
clang::Decl *target = usd->getTargetDecl();
diff --git a/lldb/source/Symbol/CompilerDeclContext.cpp b/lldb/source/Symbol/CompilerDeclContext.cpp
index 8bee1b4..10a70d9 100644
--- a/lldb/source/Symbol/CompilerDeclContext.cpp
+++ b/lldb/source/Symbol/CompilerDeclContext.cpp
@@ -15,10 +15,11 @@
using namespace lldb_private;
std::vector<CompilerDecl>
-CompilerDeclContext::FindDeclByName (ConstString name)
+CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_using_decls)
{
if (IsValid())
- return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
+ return m_type_system->DeclContextFindDeclByName(
+ m_opaque_decl_ctx, name, ignore_using_decls);
else
return std::vector<CompilerDecl>();
}
diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp
index 5c2ab5c..5b8e935 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -153,7 +153,9 @@
std::vector<CompilerDecl>
-TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
+TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx,
+ ConstString name,
+ bool ignore_imported_decls)
{
return std::vector<CompilerDecl>();
}