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();