[Lldb-commits] [lldb] r141792 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h source/Expression/ClangExpressionDeclMap.cpp
Sean Callanan
scallanan at apple.com
Wed Oct 12 11:00:54 PDT 2011
Author: spyffe
Date: Wed Oct 12 13:00:53 2011
New Revision: 141792
URL: http://llvm.org/viewvc/llvm-project?rev=141792&view=rev
Log:
Added support to ClagnExpressionDeclMap for finding
data symbols in namespaces.
Modified:
lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141792&r1=141791&r2=141792&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Wed Oct 12 13:00:53 2011
@@ -889,15 +889,23 @@
/// @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
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141792&r1=141791&r2=141792&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 13:00:53 2011
@@ -1630,7 +1630,10 @@
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 @@
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 @@
// 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)
{
More information about the lldb-commits
mailing list