Added ClangNamespaceDecl * parameters to several

core Module functions that the expression parser
will soon be using.

llvm-svn: 141766
This commit is contained in:
Sean Callanan 2011-10-12 02:08:07 +00:00
parent 8897224363
commit b6d70ebc0a
14 changed files with 67 additions and 34 deletions

View File

@ -160,7 +160,8 @@ public:
lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
size_t
FindSymbolsWithNameAndType (const ConstString &name,
FindSymbolsWithNameAndType (const ConstString &name,
const ClangNamespaceDecl *namespace_decl,
lldb::SymbolType symbol_type,
SymbolContextList &sc_list);
@ -207,6 +208,9 @@ public:
/// @param[in] name
/// The name of the compile unit we are looking for.
///
/// @param[in] namespace_decl
/// If valid, a namespace to search in.
///
/// @param[in] name_type_mask
/// A bit mask of bits that indicate what kind of names should
/// be used when doing the lookup. Bits include fully qualified
@ -225,7 +229,8 @@ public:
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
uint32_t
FindFunctions (const ConstString &name,
FindFunctions (const ConstString &name,
const ClangNamespaceDecl *namespace_decl,
uint32_t name_type_mask,
bool symbols_ok,
bool append,
@ -266,6 +271,9 @@ public:
/// The name of the global or static variable we are looking
/// for.
///
/// @param[in] namespace_decl
/// If valid, a namespace to search in.
///
/// @param[in] append
/// If \b true, any matches will be appended to \a
/// variable_list, else matches replace the contents of
@ -283,7 +291,8 @@ public:
/// The number of matches added to \a variable_list.
//------------------------------------------------------------------
uint32_t
FindGlobalVariables (const ConstString &name,
FindGlobalVariables (const ConstString &name,
const ClangNamespaceDecl *namespace_decl,
bool append,
uint32_t max_matches,
VariableList& variable_list);
@ -326,6 +335,9 @@ public:
/// @param[in] name
/// The name of the type we are looking for.
///
/// @param[in] namespace_decl
/// If valid, a namespace to search in.
///
/// @param[in] append
/// If \b true, any matches will be appended to \a
/// variable_list, else matches replace the contents of
@ -350,8 +362,9 @@ public:
/// The number of matches added to \a type_list.
//------------------------------------------------------------------
uint32_t
FindTypes (const SymbolContext& sc,
const ConstString &name,
FindTypes (const SymbolContext& sc,
const ConstString &name,
const ClangNamespaceDecl *namespace_decl,
bool append,
uint32_t max_matches,
TypeList& types);

View File

@ -344,7 +344,8 @@ SBModule::FindFunctions (const char *name,
if (m_opaque_sp)
{
const bool symbols_ok = true;
return m_opaque_sp->FindFunctions (ConstString(name),
return m_opaque_sp->FindFunctions (ConstString(name),
NULL,
name_type_mask,
symbols_ok,
append,
@ -361,7 +362,8 @@ SBModule::FindGlobalVariables (SBTarget &target, const char *name, uint32_t max_
if (m_opaque_sp)
{
VariableList variable_list;
const uint32_t match_count = m_opaque_sp->FindGlobalVariables (ConstString (name),
const uint32_t match_count = m_opaque_sp->FindGlobalVariables (ConstString (name),
NULL,
false,
max_matches,
variable_list);
@ -398,6 +400,7 @@ SBModule::FindFirstType (const char* name_cstr)
num_matches = m_opaque_sp->FindTypes(sc,
name,
NULL,
false,
1,
type_list);
@ -423,6 +426,7 @@ SBModule::FindTypes (const char* type)
num_matches = m_opaque_sp->FindTypes(sc,
name,
NULL,
false,
UINT32_MAX,
type_list);

View File

@ -16,6 +16,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Target/Target.h"
using namespace lldb;
@ -128,17 +129,18 @@ BreakpointResolverName::SearchCallback
if (context.module_sp)
{
uint32_t num_functions = context.module_sp->FindFunctions (m_func_name,
m_func_name_type_mask,
include_symbols,
append,
func_list);
NULL,
m_func_name_type_mask,
include_symbols,
append,
func_list);
// If the search filter specifies a Compilation Unit, then we don't need to bother to look in plain
// symbols, since all the ones from a set compilation unit will have been found above already.
if (num_functions == 0 && !filter_by_cu)
{
if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeAuto))
context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list);
context.module_sp->FindSymbolsWithNameAndType (m_func_name, NULL, eSymbolTypeCode, sym_list);
}
}
break;

View File

@ -25,6 +25,7 @@
#include "lldb/Interpreter/OptionGroupFormat.h"
#include "lldb/Interpreter/OptionGroupOutputFile.h"
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
@ -447,8 +448,9 @@ public:
sc = frame->GetSymbolContext (eSymbolContextModule);
if (sc.module_sp)
{
sc.module_sp->FindTypes (sc,
lookup_type_name,
sc.module_sp->FindTypes (sc,
lookup_type_name,
NULL,
append,
1,
type_list);

View File

@ -1498,7 +1498,8 @@ LookupFunctionInModule (CommandInterpreter &interpreter, Stream &strm, Module *m
else
{
ConstString function_name (name);
num_matches = module->FindFunctions (function_name,
num_matches = module->FindFunctions (function_name,
NULL,
eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector,
include_symbols,
append,
@ -1543,7 +1544,7 @@ LookupTypeInModule (CommandInterpreter &interpreter,
// else
// {
ConstString name(name_cstr);
num_matches = module->FindTypes(sc, name, true, UINT32_MAX, type_list);
num_matches = module->FindTypes(sc, name, NULL, true, UINT32_MAX, type_list);
// }
if (num_matches)

View File

@ -12,6 +12,7 @@
// Project includes
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/lldb-private-log.h"
using namespace lldb;
@ -109,10 +110,12 @@ AddressResolverName::SearchCallback
case AddressResolver::Exact:
if (context.module_sp)
{
context.module_sp->FindSymbolsWithNameAndType (m_func_name,
context.module_sp->FindSymbolsWithNameAndType (m_func_name,
NULL,
eSymbolTypeCode,
sym_list);
context.module_sp->FindFunctions (m_func_name,
context.module_sp->FindFunctions (m_func_name,
NULL,
eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector,
include_symbols,
append,

View File

@ -24,6 +24,7 @@
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Timer.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
@ -166,7 +167,8 @@ Disassembler::Disassemble
const bool include_symbols = true;
if (module)
{
module->FindFunctions (name,
module->FindFunctions (name,
NULL,
eFunctionNameTypeBase |
eFunctionNameTypeFull |
eFunctionNameTypeMethod |

View File

@ -350,7 +350,7 @@ Module::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t li
uint32_t
Module::FindGlobalVariables(const ConstString &name, bool append, uint32_t max_matches, VariableList& variables)
Module::FindGlobalVariables(const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables)
{
SymbolVendor *symbols = GetSymbolVendor ();
if (symbols)
@ -389,7 +389,8 @@ Module::FindCompileUnits (const FileSpec &path,
}
uint32_t
Module::FindFunctions (const ConstString &name,
Module::FindFunctions (const ConstString &name,
const ClangNamespaceDecl *namespace_decl,
uint32_t name_type_mask,
bool include_symbols,
bool append,
@ -509,7 +510,7 @@ StripTypeName(const char* name_cstr)
}
uint32_t
Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
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);
@ -686,7 +687,7 @@ Module::SymbolIndicesToSymbolContextList (Symtab *symtab, std::vector<uint32_t>
}
size_t
Module::FindSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, SymbolContextList &sc_list)
Module::FindSymbolsWithNameAndType (const ConstString &name, const ClangNamespaceDecl *namespace_decl, SymbolType symbol_type, SymbolContextList &sc_list)
{
// No need to protect this call using m_mutex all other method calls are
// already thread safe.

View File

@ -16,6 +16,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/VariableList.h"
@ -186,7 +187,7 @@ ModuleList::FindFunctions (const ConstString &name,
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
(*pos)->FindFunctions (name, name_type_mask, include_symbols, true, sc_list);
(*pos)->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list);
}
return sc_list.GetSize();
@ -221,7 +222,7 @@ ModuleList::FindGlobalVariables (const ConstString &name,
collection::iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
(*pos)->FindGlobalVariables (name, append, max_matches, variable_list);
(*pos)->FindGlobalVariables (name, NULL, append, max_matches, variable_list);
}
return variable_list.GetSize() - initial_size;
}
@ -253,7 +254,7 @@ ModuleList::FindSymbolsWithNameAndType (const ConstString &name,
sc_list.Clear();
collection::iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
(*pos)->FindSymbolsWithNameAndType (name, symbol_type, sc_list);
(*pos)->FindSymbolsWithNameAndType (name, NULL, symbol_type, sc_list);
return sc_list.GetSize();
}
@ -423,7 +424,7 @@ ModuleList::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, bo
for (pos = m_modules.begin(); pos != end; ++pos)
{
if (sc.module_sp.get() == NULL || sc.module_sp.get() == (*pos).get())
total_matches += (*pos)->FindTypes (sc, name, true, max_matches, types);
total_matches += (*pos)->FindTypes (sc, name, NULL, true, max_matches, types);
if (total_matches >= max_matches)
break;

View File

@ -16,6 +16,7 @@
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/Target.h"
@ -244,7 +245,7 @@ SourceManager::GetDefaultFileAndLine (FileSpec &file_spec, uint32_t &line)
ConstString main_name("main");
bool symbols_okay = false; // Force it to be a debug symbol.
bool append = false;
num_matches = executable_ptr->FindFunctions (main_name, lldb::eFunctionNameTypeBase, symbols_okay, append, sc_list);
num_matches = executable_ptr->FindFunctions (main_name, NULL, lldb::eFunctionNameTypeBase, symbols_okay, append, sc_list);
for (uint32_t idx = 0; idx < num_matches; idx++)
{
SymbolContext sc;

View File

@ -626,7 +626,7 @@ FindCodeSymbolInContext
)
{
if (sym_ctx.module_sp)
sym_ctx.module_sp->FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list);
sym_ctx.module_sp->FindSymbolsWithNameAndType(name, NULL, eSymbolTypeCode, sc_list);
if (!sc_list.GetSize())
sym_ctx.target_sp->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list);

View File

@ -22,6 +22,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/UUID.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/ObjectFile.h"
@ -1695,7 +1696,7 @@ ObjectFileMachO::GetEntryPointAddress ()
SymbolContextList contexts;
SymbolContext context;
if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts))
if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), NULL, eSymbolTypeCode, contexts))
return m_entry_point_address;
contexts.GetContextAtIndex(0, context);

View File

@ -19,6 +19,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/Process.h"
@ -131,7 +132,8 @@ OperatingSystemDarwinKernel::GetThreadListValueObject ()
Module *exe_module = m_process->GetTarget().GetExecutableModulePointer();
if (exe_module)
{
if (exe_module->FindGlobalVariables (g_thread_list_name,
if (exe_module->FindGlobalVariables (g_thread_list_name,
NULL,
append,
max_matches,
variable_list))

View File

@ -479,7 +479,7 @@ SymbolContext::FindFunctionsByName (const ConstString &name,
}
if (module_sp)
module_sp->FindFunctions (name, name_type_mask, include_symbols, true, sc_list);
module_sp->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list);
if (target_sp)
{
@ -495,7 +495,7 @@ SymbolContext::FindFunctionsByName (const ConstString &name,
{
ModuleSP iter_module_sp = modules.GetModuleAtIndex(i);
if (module_sp != iter_module_sp)
iter_module_sp->FindFunctions (name, name_type_mask, include_symbols, true, sc_list);
iter_module_sp->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list);
}
}
}
@ -516,7 +516,7 @@ SymbolContext::FindTypeByName (const ConstString &name) const
TypeList types;
if (module_sp && module_sp->FindTypes (*this, name, false, 1, types))
if (module_sp && module_sp->FindTypes (*this, name, NULL, false, 1, types))
return types.GetTypeAtIndex(0);
SymbolContext sc_for_global_search;