diff options
-rw-r--r-- | lldb/include/lldb/Expression/ClangExpressionDeclMap.h | 10 | ||||
-rw-r--r-- | lldb/source/Expression/ClangExpressionDeclMap.cpp | 33 |
2 files changed, 36 insertions, 7 deletions
diff --git a/lldb/include/lldb/Expression/ClangExpressionDeclMap.h b/lldb/include/lldb/Expression/ClangExpressionDeclMap.h index d7e286d8c17..e7e96515e10 100644 --- a/lldb/include/lldb/Expression/ClangExpressionDeclMap.h +++ b/lldb/include/lldb/Expression/ClangExpressionDeclMap.h @@ -889,15 +889,23 @@ private: /// @param[in] target /// The target to use as the basis for the search. /// + /// @param[in] module + /// If non-NULL, the module to query. + /// /// @param[in] name /// The name as a plain C string. /// + /// @param[in] namespace_decl + /// If valid and module is non-NULL, the parent namespace. + /// /// @return /// The LLDB Symbol found, or NULL if none was found. //--------------------------------------------------------- Symbol * FindGlobalDataSymbol (Target &target, - const ConstString &name); + lldb::ModuleSP &module, + const ConstString &name, + ClangNamespaceDecl *namespace_decl); //------------------------------------------------------------------ /// Given a target, find a variable that matches the given name and diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 4256a1827e8..c28f26db7f9 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -1630,7 +1630,10 @@ ClangExpressionDeclMap::DoMaterializeOneVariable TypeFromUser type(expr_var->GetTypeFromUser()); VariableSP var = FindVariableInScope (*frame, name, &type); - Symbol *sym = FindGlobalDataSymbol(*target, name); + + ModuleSP module; + + Symbol *sym = FindGlobalDataSymbol(*target, module, name, NULL); std::auto_ptr<lldb_private::Value> location_value; @@ -1977,14 +1980,22 @@ Symbol * ClangExpressionDeclMap::FindGlobalDataSymbol ( Target &target, - const ConstString &name + ModuleSP &module, + const ConstString &name, + ClangNamespaceDecl *namespace_decl ) { SymbolContextList sc_list; - target.GetImages().FindSymbolsWithNameAndType(name, - eSymbolTypeData, - sc_list); + if (module && namespace_decl) + module->FindSymbolsWithNameAndType(name, + namespace_decl, + eSymbolTypeData, + sc_list); + else + target.GetImages().FindSymbolsWithNameAndType(name, + eSymbolTypeData, + sc_list); if (sc_list.GetSize()) { @@ -2430,7 +2441,17 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, // We couldn't find a variable or function for this. Now we'll hunt for a generic // data symbol, and -- if it is found -- treat it as a variable. - Symbol *data_symbol = FindGlobalDataSymbol(*target, name); + Symbol *data_symbol; + + if (namespace_decl && module) + { + data_symbol = FindGlobalDataSymbol(*target, module, name, &namespace_decl); + } + else + { + ModuleSP module; + data_symbol = FindGlobalDataSymbol(*target, module, name, NULL); + } if (data_symbol) { |