Added FindTypes to Module and ModuleList.

llvm-svn: 110093
This commit is contained in:
Greg Clayton 2010-08-03 01:26:16 +00:00
parent 4887001f81
commit 3504eee8a8
4 changed files with 77 additions and 13 deletions

View File

@ -283,8 +283,8 @@ public:
/// @return
/// The number of matches added to \a type_list.
//------------------------------------------------------------------
// uint32_t
// FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& type_list);
uint32_t
FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types);
//------------------------------------------------------------------
/// Find types by name.

View File

@ -270,7 +270,46 @@ public:
lldb::SymbolType symbol_type,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find types by name.
///
/// @param[in] sc
/// A symbol context that scopes where to extract a type list
/// from.
///
/// @param[in] name
/// The name of the type we are looking for.
///
/// @param[in] append
/// If \b true, any matches will be appended to \a
/// variable_list, else matches replace the contents of
/// \a variable_list.
///
/// @param[in] max_matches
/// Allow the number of matches to be limited to \a
/// max_matches. Specify UINT_MAX to get all possible matches.
///
/// @param[in] encoding
/// Limit the search to specific types, or get all types if
/// set to Type::invalid.
///
/// @param[in] udt_name
/// If the encoding is a user defined type, specify the name
/// of the user defined type ("struct", "union", "class", etc).
///
/// @param[out] type_list
/// A type list gets populated with any matches.
///
/// @return
/// The number of matches added to \a type_list.
//------------------------------------------------------------------
uint32_t
FindTypes (const SymbolContext& sc,
const ConstString &name,
bool append,
uint32_t max_matches,
TypeList& types);
bool
Remove (lldb::ModuleSP &module_sp);

View File

@ -303,16 +303,19 @@ Module::FindFunctions(const RegularExpression& regex, bool append, SymbolContext
return 0;
}
//uint32_t
//Module::FindTypes(const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types)
//{
// Timer scoped_timer(__PRETTY_FUNCTION__);
// SymbolVendor *symbols = GetSymbolVendor ();
// if (symbols)
// return symbols->FindTypes(sc, name, append, max_matches, encoding, udt_name, types);
// return 0;
//}
//
uint32_t
Module::FindTypes (const SymbolContext& sc, const ConstString &name, 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 0;
}
//uint32_t
//Module::FindTypes(const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types)
//{

View File

@ -290,6 +290,28 @@ ModuleList::FindModule (lldb_private::Module *module_ptr)
}
uint32_t
ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
{
Mutex::Locker locker(m_modules_mutex);
if (!append)
types.Clear();
uint32_t total_matches = 0;
collection::const_iterator pos, end = m_modules.end();
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);
if (total_matches >= max_matches)
break;
}
return total_matches;
}
ModuleSP
ModuleList::FindFirstModuleForFileSpec (const FileSpec &file_spec, const ConstString *object_name)
{