Completed the glue that passes a ClangNamespaceDecl *
down through Module and SymbolVendor into SymbolFile.
Added checks to SymbolFileDWARF that restrict symbol
searches when a namespace is passed in.

llvm-svn: 141847
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 9139548..429362c 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -354,7 +354,7 @@
 {
     SymbolVendor *symbols = GetSymbolVendor ();
     if (symbols)
-        return symbols->FindGlobalVariables(name, append, max_matches, variables);
+        return symbols->FindGlobalVariables(name, namespace_decl, append, max_matches, variables);
     return 0;
 }
 uint32_t
@@ -404,7 +404,7 @@
     // Find all the functions (not symbols, but debug information functions...
     SymbolVendor *symbols = GetSymbolVendor ();
     if (symbols)
-        symbols->FindFunctions(name, name_type_mask, append, sc_list);
+        symbols->FindFunctions(name, namespace_decl, name_type_mask, append, sc_list);
 
     // Now check our symbol table for symbols that are code symbols if requested
     if (include_symbols)
@@ -477,14 +477,14 @@
 }
 
 uint32_t
-Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
 {
     Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
     if (sc.module_sp.get() == NULL || sc.module_sp.get() == this)
     {
         SymbolVendor *symbols = GetSymbolVendor ();
         if (symbols)
-            return symbols->FindTypes(sc, name, append, max_matches, types);
+            return symbols->FindTypes(sc, name, namespace_decl, append, max_matches, types);
     }
     return 0;
 }
@@ -512,12 +512,12 @@
 uint32_t
 Module::FindTypes (const SymbolContext& sc,  const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
 {
-    uint32_t retval = FindTypes_Impl(sc, name, append, max_matches, types);
+    uint32_t retval = FindTypes_Impl(sc, name, namespace_decl, append, max_matches, types);
     
     if (retval == 0)
     {
         const char *stripped = StripTypeName(name.GetCString());
-        return FindTypes_Impl(sc, ConstString(stripped), append, max_matches, types);
+        return FindTypes_Impl(sc, ConstString(stripped), namespace_decl, append, max_matches, types);
     }
     else
         return retval;
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 81416c2..44f40d6 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -2440,7 +2440,7 @@
             
             SymbolContext null_sc;
             
-            namespace_decl = symbol_vendor->FindNamespace(null_sc, name);
+            namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &namespace_decl);
 
             if (namespace_decl)
             {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 11400b5..bbbbce0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2008,7 +2008,7 @@
     return false;
 }
 uint32_t
-SymbolFileDWARF::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables)
+SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables)
 {
     LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
 
@@ -2019,6 +2019,10 @@
                      m_obj_file->GetFileSpec().GetFilename().GetCString(),
                      name.GetCString(), append, max_matches);
     }
+    
+    if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl))
+		return 0;
+    
     DWARFDebugInfo* info = DebugInfo();
     if (info == NULL)
         return 0;
@@ -2070,6 +2074,9 @@
 
             sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
             assert(sc.comp_unit != NULL);
+            
+            if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+                continue;
 
             ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables);
 
@@ -2343,6 +2350,7 @@
 
 uint32_t
 SymbolFileDWARF::FindFunctions (const ConstString &name, 
+                                const lldb_private::ClangNamespaceDecl *namespace_decl, 
                                 uint32_t name_type_mask, 
                                 bool append, 
                                 SymbolContextList& sc_list)
@@ -2364,6 +2372,9 @@
     // If we aren't appending the results to this list, then clear the list
     if (!append)
         sc_list.Clear();
+    
+    if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl))
+		return 0;
         
     // If name is empty then we won't find anything.
     if (name.IsEmpty())
@@ -2442,6 +2453,9 @@
                 const DWARFDebugInfoEntry *die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
                 if (die)
                 {
+                    if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+                        continue;
+                    
                     ResolveFunction (dwarf_cu, die, sc_list);
                 }
             }
@@ -2450,6 +2464,9 @@
         {                
             if (effective_name_type_mask & eFunctionNameTypeSelector)
             {
+                if (namespace_decl && *namespace_decl)
+                    return 0; // no selectors in namespaces
+                    
                 num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets);
                 // Now make sure these are actually ObjC methods.  In this case we can simply look up the name,
                 // and if it is an ObjC method name, we're good.
@@ -2470,6 +2487,10 @@
             if (effective_name_type_mask & eFunctionNameTypeMethod
                 || effective_name_type_mask & eFunctionNameTypeBase)
             {
+                if ((effective_name_type_mask & eFunctionNameTypeMethod) &&
+                    (namespace_decl && *namespace_decl))
+                    return 0; // no methods in namespaces
+                
                 // The apple_names table stores just the "base name" of C++ methods in the table.  So we have to 
                 // extract the base name, look that up, and if there is any other information in the name we were
                 // passed in we have to post-filter based on that.
@@ -2483,6 +2504,9 @@
                     const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
                     if (die)
                     {
+                        if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+                            continue;
+                        
                         if (!FunctionDieMatchesPartialName(die, 
                                                            dwarf_cu, 
                                                            effective_name_type_mask, 
@@ -2522,6 +2546,9 @@
                 const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
                 if (die)
                 {
+                    if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+                        continue;
+                    
                     if (!FunctionDieMatchesPartialName(die, 
                                                        dwarf_cu, 
                                                        effective_name_type_mask, 
@@ -2539,6 +2566,9 @@
         
         if (effective_name_type_mask & eFunctionNameTypeMethod)
         {
+            if (namespace_decl && *namespace_decl)
+                return 0; // no methods in namespaces
+
             uint32_t num_base = m_function_method_index.Find(base_name_const, die_offsets);
             {
                 for (uint32_t i = 0; i < num_base; i++)
@@ -2562,7 +2592,7 @@
             die_offsets.clear();
         }
 
-        if (effective_name_type_mask & eFunctionNameTypeSelector)
+        if ((effective_name_type_mask & eFunctionNameTypeSelector) && (!namespace_decl || !*namespace_decl))
         {
             FindFunctions (name, m_function_selector_index, sc_list);
         }
@@ -2653,7 +2683,7 @@
 }
 
 uint32_t
-SymbolFileDWARF::FindTypes(const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+SymbolFileDWARF::FindTypes(const SymbolContext& sc, const ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
 {
     DWARFDebugInfo* info = DebugInfo();
     if (info == NULL)
@@ -2672,6 +2702,9 @@
     // If we aren't appending the results to this list, then clear the list
     if (!append)
         types.Clear();
+    
+    if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl))
+		return 0;
 
     DIEArray die_offsets;
     
@@ -2702,6 +2735,9 @@
             const dw_offset_t die_offset = die_offsets[i];
             die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
 
+            if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+                continue;
+            
             Type *matching_type = ResolveType (dwarf_cu, die);
             if (matching_type)
             {
@@ -2727,7 +2763,8 @@
 
 ClangNamespaceDecl
 SymbolFileDWARF::FindNamespace (const SymbolContext& sc, 
-                                const ConstString &name)
+                                const ConstString &name,
+                                const lldb_private::ClangNamespaceDecl *parent_namespace_decl)
 {
     LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
     
@@ -2738,6 +2775,9 @@
                      m_obj_file->GetFileSpec().GetFilename().GetCString(),
                      name.GetCString());
     }
+    
+    if (!NamespaceDeclMatchesThisSymbolFile(parent_namespace_decl))
+		return ClangNamespaceDecl();
 
     ClangNamespaceDecl namespace_decl;
     DWARFDebugInfo* info = DebugInfo();
@@ -2770,6 +2810,9 @@
             {
                 const dw_offset_t die_offset = die_offsets[i];
                 die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
+                
+                if (parent_namespace_decl && !DIEIsInNamespace (parent_namespace_decl, dwarf_cu, die))
+                    continue;
 
                 clang::NamespaceDecl *clang_namespace_decl = ResolveNamespaceDIE (dwarf_cu, die);
                 if (clang_namespace_decl)
@@ -4120,7 +4163,7 @@
                                 {
                                     ConstString class_name (class_name_start, class_name_end - class_name_start);
                                     TypeList types;
-                                    const uint32_t match_count = FindTypes (empty_sc, class_name, true, UINT32_MAX, types);
+                                    const uint32_t match_count = FindTypes (empty_sc, class_name, NULL, true, UINT32_MAX, types);
                                     if (match_count > 0)
                                     {
                                         for (uint32_t i=0; i<match_count; ++i)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 4a9080c..4baf8a9a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -107,11 +107,11 @@
 
     virtual uint32_t        ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc);
     virtual uint32_t        ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list);
-    virtual uint32_t        FindGlobalVariables(const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
+    virtual uint32_t        FindGlobalVariables(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
     virtual uint32_t        FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
-    virtual uint32_t        FindFunctions(const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
+    virtual uint32_t        FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
     virtual uint32_t        FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
-    virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
+    virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types);
     virtual lldb_private::TypeList *
                             GetTypeList ();
     virtual lldb_private::ClangASTContext &
@@ -119,7 +119,8 @@
 
     virtual lldb_private::ClangNamespaceDecl
             FindNamespace (const lldb_private::SymbolContext& sc, 
-                           const lldb_private::ConstString &name);
+                           const lldb_private::ConstString &name, 
+                           const lldb_private::ClangNamespaceDecl *parent_namespace_decl);
 
 
     //------------------------------------------------------------------
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 92c6f8f..2d702bc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -702,6 +702,7 @@
 SymbolFileDWARFDebugMap::PrivateFindGlobalVariables
 (
     const ConstString &name,
+    const ClangNamespaceDecl *namespace_decl,
     const std::vector<uint32_t> &indexes,   // Indexes into the symbol table that match "name"
     uint32_t max_matches,
     VariableList& variables
@@ -718,7 +719,7 @@
             SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx);
             if (oso_dwarf)
             {
-                if (oso_dwarf->FindGlobalVariables(name, true, max_matches, variables))
+                if (oso_dwarf->FindGlobalVariables(name, namespace_decl, true, max_matches, variables))
                     if (variables.GetSize() > max_matches)
                         break;
             }
@@ -728,7 +729,7 @@
 }
 
 uint32_t
-SymbolFileDWARFDebugMap::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables)
+SymbolFileDWARFDebugMap::FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables)
 {
 
     // If we aren't appending the results to this list, then clear the list
@@ -743,7 +744,8 @@
     SymbolFileDWARF *oso_dwarf;
     for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx)
     {
-        const uint32_t oso_matches = oso_dwarf->FindGlobalVariables (name, 
+        const uint32_t oso_matches = oso_dwarf->FindGlobalVariables (name,
+                                                                     namespace_decl,
                                                                      true, 
                                                                      max_matches, 
                                                                      variables);
@@ -917,7 +919,7 @@
 }
 
 uint32_t
-SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
+SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
 {
     Timer scoped_timer (__PRETTY_FUNCTION__,
                         "SymbolFileDWARFDebugMap::FindFunctions (name = %s)",
@@ -934,7 +936,7 @@
     while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL)
     {
         uint32_t sc_idx = sc_list.GetSize();
-        if (oso_dwarf->FindFunctions(name, name_type_mask, true, sc_list))
+        if (oso_dwarf->FindFunctions(name, namespace_decl, name_type_mask, true, sc_list))
         {
             RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx);
         }
@@ -994,7 +996,8 @@
 SymbolFileDWARFDebugMap::FindTypes 
 (
     const SymbolContext& sc, 
-    const ConstString &name, 
+    const ConstString &name,
+    const ClangNamespaceDecl *namespace_decl,
     bool append, 
     uint32_t max_matches, 
     TypeList& types
@@ -1010,13 +1013,13 @@
     {
         oso_dwarf = GetSymbolFile (sc);
         if (oso_dwarf)
-            return oso_dwarf->FindTypes (sc, name, append, max_matches, types);
+            return oso_dwarf->FindTypes (sc, name, namespace_decl, append, max_matches, types);
     }
     else
     {
         uint32_t oso_idx = 0;
         while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL)
-            oso_dwarf->FindTypes (sc, name, append, max_matches, types);
+            oso_dwarf->FindTypes (sc, name, namespace_decl, append, max_matches, types);
     }
 
     return types.GetSize() - initial_types_size;
@@ -1035,7 +1038,8 @@
 
 ClangNamespaceDecl
 SymbolFileDWARFDebugMap::FindNamespace (const lldb_private::SymbolContext& sc, 
-                                        const lldb_private::ConstString &name)
+                                        const lldb_private::ConstString &name,
+                                        const ClangNamespaceDecl *parent_namespace_decl)
 {
     ClangNamespaceDecl matching_namespace;
     SymbolFileDWARF *oso_dwarf;
@@ -1044,7 +1048,7 @@
     {
         oso_dwarf = GetSymbolFile (sc);
         if (oso_dwarf)
-            matching_namespace = oso_dwarf->FindNamespace (sc, name);
+            matching_namespace = oso_dwarf->FindNamespace (sc, name, parent_namespace_decl);
     }
     else
     {
@@ -1052,7 +1056,7 @@
              ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); 
              ++oso_idx)
         {
-            matching_namespace = oso_dwarf->FindNamespace (sc, name);
+            matching_namespace = oso_dwarf->FindNamespace (sc, name, parent_namespace_decl);
 
             if (matching_namespace)
                 break;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 3aa76a3..8d722a1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -69,14 +69,15 @@
     virtual lldb::clang_type_t  ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_Type);
     virtual uint32_t        ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc);
     virtual uint32_t        ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list);
-    virtual uint32_t        FindGlobalVariables (const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
+    virtual uint32_t        FindGlobalVariables (const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
     virtual uint32_t        FindGlobalVariables (const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
-    virtual uint32_t        FindFunctions (const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
+    virtual uint32_t        FindFunctions (const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
     virtual uint32_t        FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
-    virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
+    virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types);
     virtual lldb_private::ClangNamespaceDecl
             FindNamespace (const lldb_private::SymbolContext& sc, 
-                           const lldb_private::ConstString &name);
+                           const lldb_private::ConstString &name,
+                           const lldb_private::ClangNamespaceDecl *parent_namespace_decl);
 
 
     //------------------------------------------------------------------
@@ -191,6 +192,7 @@
 
     uint32_t
     PrivateFindGlobalVariables (const lldb_private::ConstString &name,
+                                const lldb_private::ClangNamespaceDecl *namespace_decl,
                                 const std::vector<uint32_t> &name_symbol_indexes,
                                 uint32_t max_matches,
                                 lldb_private::VariableList& variables);
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 14517e6..c3e02d7 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -280,7 +280,7 @@
 }
 
 ClangNamespaceDecl 
-SymbolFileSymtab::FindNamespace (const SymbolContext& sc, const ConstString &name)
+SymbolFileSymtab::FindNamespace (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl)
 {
     return ClangNamespaceDecl();
 }
@@ -308,7 +308,7 @@
 }
 
 uint32_t
-SymbolFileSymtab::FindGlobalVariables(const ConstString &name, bool append, uint32_t max_matches, VariableList& variables)
+SymbolFileSymtab::FindGlobalVariables(const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables)
 {
     return 0;
 }
@@ -320,7 +320,7 @@
 }
 
 uint32_t
-SymbolFileSymtab::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
+SymbolFileSymtab::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
 {
     Timer scoped_timer (__PRETTY_FUNCTION__,
                         "SymbolFileSymtab::FindFunctions (name = '%s')",
@@ -348,7 +348,7 @@
 }
 
 uint32_t
-SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types)
+SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types)
 {
     if (!append)
         types.Clear();
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index f95e0ce..ba43a30 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -84,26 +84,27 @@
     ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list);
 
     virtual uint32_t
-    FindGlobalVariables(const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
+    FindGlobalVariables(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
 
     virtual uint32_t
     FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
 
     virtual uint32_t
-    FindFunctions(const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
+    FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
 
     virtual uint32_t
     FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
 
     virtual uint32_t
-    FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
+    FindTypes (const lldb_private::SymbolContext& sc,const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types);
 
 //  virtual uint32_t
 //  FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::TypeList& types);
 
     virtual lldb_private::ClangNamespaceDecl
     FindNamespace (const lldb_private::SymbolContext& sc, 
-                   const lldb_private::ConstString &name);
+                   const lldb_private::ConstString &name, 
+                   const lldb_private::ClangNamespaceDecl *parent_namespace_decl);
 
     //------------------------------------------------------------------
     // PluginInterface protocol
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 261b148..f571d44 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -457,7 +457,7 @@
 {
     ClangNamespaceDecl namespace_decl;
     if (module_sp)
-        namespace_decl = module_sp->GetSymbolVendor()->FindNamespace (*this, name);
+        namespace_decl = module_sp->GetSymbolVendor()->FindNamespace (*this, name, NULL);
     return namespace_decl;
 }
 
diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp
index 4c23640..7711923 100644
--- a/lldb/source/Symbol/SymbolVendor.cpp
+++ b/lldb/source/Symbol/SymbolVendor.cpp
@@ -216,11 +216,11 @@
 }
 
 uint32_t
-SymbolVendor::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables)
+SymbolVendor::FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables)
 {
     Mutex::Locker locker(m_mutex);
     if (m_sym_file_ap.get())
-        return m_sym_file_ap->FindGlobalVariables(name, append, max_matches, variables);
+        return m_sym_file_ap->FindGlobalVariables(name, namespace_decl, append, max_matches, variables);
     return 0;
 }
 
@@ -234,11 +234,11 @@
 }
 
 uint32_t
-SymbolVendor::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
+SymbolVendor::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
 {
     Mutex::Locker locker(m_mutex);
     if (m_sym_file_ap.get())
-        return m_sym_file_ap->FindFunctions(name, name_type_mask, append, sc_list);
+        return m_sym_file_ap->FindFunctions(name, namespace_decl, name_type_mask, append, sc_list);
     return 0;
 }
 
@@ -253,23 +253,23 @@
 
 
 uint32_t
-SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
 {
     Mutex::Locker locker(m_mutex);
     if (m_sym_file_ap.get())
-        return m_sym_file_ap->FindTypes(sc, name, append, max_matches, types);
+        return m_sym_file_ap->FindTypes(sc, name, namespace_decl, append, max_matches, types);
     if (!append)
         types.Clear();
     return 0;
 }
 
 ClangNamespaceDecl
-SymbolVendor::FindNamespace(const SymbolContext& sc, const ConstString &name)
+SymbolVendor::FindNamespace(const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *parent_namespace_decl)
 {
     Mutex::Locker locker(m_mutex);
     ClangNamespaceDecl namespace_decl;
     if (m_sym_file_ap.get())
-        namespace_decl = m_sym_file_ap->FindNamespace (sc, name);
+        namespace_decl = m_sym_file_ap->FindNamespace (sc, name, parent_namespace_decl);
     return namespace_decl;
 }