Remove unused "append" parameter from FindTypes API

I noticed that SymbolFileDWARFDebugMap::FindTypes was implementing it
incorrectly (passing append=false in a for-loop to recursive calls to
FindTypes would yield only the very last set of results), but instead
of fixing it, removing it seemed like an even better option.

rdar://problem/54412692

Differential Revision: https://reviews.llvm.org/D68171

llvm-svn: 373224
This commit is contained in:
Adrian Prantl
2019-09-30 16:42:28 +00:00
parent 09025ca6fc
commit d4d428ef92
16 changed files with 87 additions and 131 deletions

View File

@@ -941,13 +941,13 @@ void Module::FindAddressesForLine(const lldb::TargetSP target_sp,
size_t Module::FindTypes_Impl(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
bool append, size_t max_matches,
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 (SymbolFile *symbols = GetSymbolFile())
return symbols->FindTypes(name, parent_decl_ctx, append, max_matches,
return symbols->FindTypes(name, parent_decl_ctx, max_matches,
searched_symbol_files, types);
return 0;
}
@@ -955,12 +955,10 @@ size_t Module::FindTypes_Impl(
size_t Module::FindTypesInNamespace(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(type_name, parent_decl_ctx, append, max_matches,
searched_symbol_files, types_map);
size_t num_types = FindTypes_Impl(type_name, parent_decl_ctx, max_matches,
searched_symbol_files, types_map);
if (num_types > 0) {
SymbolContext sc;
sc.module_sp = shared_from_this();
@@ -988,7 +986,6 @@ size_t Module::FindTypes(
const char *type_name_cstr = name.GetCString();
llvm::StringRef type_scope;
llvm::StringRef type_basename;
const bool append = true;
TypeClass type_class = eTypeClassAny;
TypeMap typesmap;
@@ -1001,7 +998,7 @@ size_t Module::FindTypes(
exact_match = type_scope.consume_front("::");
ConstString type_basename_const_str(type_basename);
if (FindTypes_Impl(type_basename_const_str, nullptr, append, max_matches,
if (FindTypes_Impl(type_basename_const_str, nullptr, max_matches,
searched_symbol_files, typesmap)) {
typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
exact_match);
@@ -1013,13 +1010,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(ConstString(type_basename), nullptr, append, UINT_MAX,
FindTypes_Impl(ConstString(type_basename), nullptr, 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(name, nullptr, append, UINT_MAX,
num_matches = FindTypes_Impl(name, nullptr, UINT_MAX,
searched_symbol_files, typesmap);
if (exact_match) {
std::string name_str(name.AsCString(""));
@@ -1038,11 +1035,11 @@ size_t Module::FindTypes(
}
size_t Module::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
LanguageSet languages, bool append, TypeMap &types) {
LanguageSet languages, TypeMap &types) {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
if (SymbolFile *symbols = GetSymbolFile())
return symbols->FindTypes(pattern, languages, append, types);
return symbols->FindTypes(pattern, languages, types);
return 0;
}