[SymbolFile] Remove SymbolContext parameter from FindTypes.
This parameter was only ever used with the Module set, and since a SymbolFile is tied to a module, the parameter turns out to be entirely unnecessary. Furthermore, it doesn't make a lot of sense to ask a caller to ask SymbolFile which is tied to Module X to find types for Module Y, but that possibility was open with the previous interface. By removing this parameter from the API, it makes it harder to use incorrectly as well as easier for an implementor to understand what it needs to do. llvm-svn: 351133
This commit is contained in:
@@ -943,33 +943,33 @@ void Module::FindAddressesForLine(const lldb::TargetSP target_sp,
|
||||
}
|
||||
|
||||
size_t Module::FindTypes_Impl(
|
||||
const SymbolContext &sc, const ConstString &name,
|
||||
const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches,
|
||||
const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
|
||||
bool append, size_t max_matches,
|
||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||
TypeMap &types) {
|
||||
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||
if (!sc.module_sp || sc.module_sp.get() == this) {
|
||||
SymbolVendor *symbols = GetSymbolVendor();
|
||||
if (symbols)
|
||||
return symbols->FindTypes(sc, name, parent_decl_ctx, append, max_matches,
|
||||
searched_symbol_files, types);
|
||||
}
|
||||
SymbolVendor *symbols = GetSymbolVendor();
|
||||
if (symbols)
|
||||
return symbols->FindTypes(name, parent_decl_ctx, append, max_matches,
|
||||
searched_symbol_files, types);
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t Module::FindTypesInNamespace(const SymbolContext &sc,
|
||||
const ConstString &type_name,
|
||||
size_t Module::FindTypesInNamespace(const ConstString &type_name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
size_t max_matches, TypeList &type_list) {
|
||||
const bool append = true;
|
||||
TypeMap types_map;
|
||||
llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
|
||||
size_t num_types =
|
||||
FindTypes_Impl(sc, type_name, parent_decl_ctx, append, max_matches,
|
||||
FindTypes_Impl(type_name, parent_decl_ctx, append, max_matches,
|
||||
searched_symbol_files, types_map);
|
||||
if (num_types > 0)
|
||||
if (num_types > 0) {
|
||||
SymbolContext sc;
|
||||
sc.module_sp = shared_from_this();
|
||||
sc.SortTypeList(types_map, type_list);
|
||||
}
|
||||
return num_types;
|
||||
}
|
||||
|
||||
@@ -978,15 +978,14 @@ lldb::TypeSP Module::FindFirstType(const SymbolContext &sc,
|
||||
TypeList type_list;
|
||||
llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
|
||||
const size_t num_matches =
|
||||
FindTypes(sc, name, exact_match, 1, searched_symbol_files, type_list);
|
||||
FindTypes(name, exact_match, 1, searched_symbol_files, type_list);
|
||||
if (num_matches)
|
||||
return type_list.GetTypeAtIndex(0);
|
||||
return TypeSP();
|
||||
}
|
||||
|
||||
size_t Module::FindTypes(
|
||||
const SymbolContext &sc, const ConstString &name, bool exact_match,
|
||||
size_t max_matches,
|
||||
const ConstString &name, bool exact_match, size_t max_matches,
|
||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||
TypeList &types) {
|
||||
size_t num_matches = 0;
|
||||
@@ -1006,8 +1005,8 @@ size_t Module::FindTypes(
|
||||
exact_match = type_scope.consume_front("::");
|
||||
|
||||
ConstString type_basename_const_str(type_basename);
|
||||
if (FindTypes_Impl(sc, type_basename_const_str, nullptr, append,
|
||||
max_matches, searched_symbol_files, typesmap)) {
|
||||
if (FindTypes_Impl(type_basename_const_str, nullptr, append, max_matches,
|
||||
searched_symbol_files, typesmap)) {
|
||||
typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
|
||||
exact_match);
|
||||
num_matches = typesmap.GetSize();
|
||||
@@ -1018,13 +1017,13 @@ size_t Module::FindTypes(
|
||||
if (type_class != eTypeClassAny && !type_basename.empty()) {
|
||||
// The "type_name_cstr" will have been modified if we have a valid type
|
||||
// class prefix (like "struct", "class", "union", "typedef" etc).
|
||||
FindTypes_Impl(sc, ConstString(type_basename), nullptr, append,
|
||||
UINT_MAX, searched_symbol_files, typesmap);
|
||||
FindTypes_Impl(ConstString(type_basename), nullptr, append, UINT_MAX,
|
||||
searched_symbol_files, typesmap);
|
||||
typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
|
||||
exact_match);
|
||||
num_matches = typesmap.GetSize();
|
||||
} else {
|
||||
num_matches = FindTypes_Impl(sc, name, nullptr, append, UINT_MAX,
|
||||
num_matches = FindTypes_Impl(name, nullptr, append, UINT_MAX,
|
||||
searched_symbol_files, typesmap);
|
||||
if (exact_match) {
|
||||
std::string name_str(name.AsCString(""));
|
||||
@@ -1034,8 +1033,11 @@ size_t Module::FindTypes(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_matches > 0)
|
||||
if (num_matches > 0) {
|
||||
SymbolContext sc;
|
||||
sc.module_sp = shared_from_this();
|
||||
sc.SortTypeList(typesmap, types);
|
||||
}
|
||||
return num_matches;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user