Index: lldb/include/lldb/Core/Module.h =================================================================== --- lldb/include/lldb/Core/Module.h +++ lldb/include/lldb/Core/Module.h @@ -499,10 +499,6 @@ /// have to specify complete scoping on all expressions, but it also allows /// for exact matching when required. /// - /// @param[in] sc - /// A symbol context that scopes where to extract a type list - /// from. - /// /// @param[in] type_name /// The name of the type we are looking for that is a fully /// or partially qualified type name. @@ -521,8 +517,7 @@ /// The number of matches added to \a type_list. //------------------------------------------------------------------ size_t - FindTypes(const SymbolContext &sc, const ConstString &type_name, - bool exact_match, size_t max_matches, + FindTypes(const ConstString &type_name, bool exact_match, size_t max_matches, llvm::DenseSet &searched_symbol_files, TypeList &types); @@ -534,10 +529,6 @@ /// expression parser when searches need to happen in an exact namespace /// scope. /// - /// @param[in] sc - /// A symbol context that scopes where to extract a type list - /// from. - /// /// @param[in] type_name /// The name of a type within a namespace that should not include /// any qualifying namespaces (just a type basename). @@ -551,8 +542,7 @@ /// @return /// The number of matches added to \a type_list. //------------------------------------------------------------------ - size_t FindTypesInNamespace(const SymbolContext &sc, - const ConstString &type_name, + size_t FindTypesInNamespace(const ConstString &type_name, const CompilerDeclContext *parent_decl_ctx, size_t max_matches, TypeList &type_list); @@ -1182,9 +1172,8 @@ Module(); // Only used internally by CreateJITModule () size_t 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 &searched_symbol_files, TypeMap &types); Index: lldb/include/lldb/Core/ModuleList.h =================================================================== --- lldb/include/lldb/Core/ModuleList.h +++ lldb/include/lldb/Core/ModuleList.h @@ -417,9 +417,9 @@ //------------------------------------------------------------------ /// Find types by name. /// - /// @param[in] sc - /// A symbol context that scopes where to extract a type list - /// from. + /// @param[in] search_first + /// If non-null, this module will be searched before any other + /// modules. /// /// @param[in] name /// The name of the type we are looking for. @@ -447,7 +447,7 @@ /// @return /// The number of matches added to \a type_list. //------------------------------------------------------------------ - size_t FindTypes(const SymbolContext &sc, const ConstString &name, + size_t FindTypes(Module *search_first, const ConstString &name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet &searched_symbol_files, TypeList &types) const; Index: lldb/include/lldb/Symbol/SymbolFile.h =================================================================== --- lldb/include/lldb/Symbol/SymbolFile.h +++ lldb/include/lldb/Symbol/SymbolFile.h @@ -193,9 +193,8 @@ bool include_inlines, bool append, SymbolContextList &sc_list); virtual uint32_t - FindTypes(const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, + FindTypes(const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap &types); virtual size_t FindTypes(const std::vector &context, Index: lldb/include/lldb/Symbol/SymbolVendor.h =================================================================== --- lldb/include/lldb/Symbol/SymbolVendor.h +++ lldb/include/lldb/Symbol/SymbolVendor.h @@ -99,9 +99,8 @@ SymbolContextList &sc_list); virtual size_t - FindTypes(const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - size_t max_matches, + FindTypes(const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, size_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap &types); Index: lldb/source/API/SBModule.cpp =================================================================== --- lldb/source/API/SBModule.cpp +++ lldb/source/API/SBModule.cpp @@ -440,13 +440,12 @@ ModuleSP module_sp(GetSP()); if (type && module_sp) { - SymbolContext sc; TypeList type_list; const bool exact_match = false; ConstString name(type); llvm::DenseSet searched_symbol_files; const uint32_t num_matches = module_sp->FindTypes( - sc, name, exact_match, UINT32_MAX, searched_symbol_files, type_list); + name, exact_match, UINT32_MAX, searched_symbol_files, type_list); if (num_matches > 0) { for (size_t idx = 0; idx < num_matches; idx++) { Index: lldb/source/API/SBTarget.cpp =================================================================== --- lldb/source/API/SBTarget.cpp +++ lldb/source/API/SBTarget.cpp @@ -1850,11 +1850,10 @@ ModuleList &images = target_sp->GetImages(); ConstString const_typename(typename_cstr); bool exact_match = false; - SymbolContext sc; TypeList type_list; llvm::DenseSet searched_symbol_files; uint32_t num_matches = - images.FindTypes(sc, const_typename, exact_match, UINT32_MAX, + images.FindTypes(nullptr, const_typename, exact_match, UINT32_MAX, searched_symbol_files, type_list); if (num_matches > 0) { Index: lldb/source/Commands/CommandObjectMemory.cpp =================================================================== --- lldb/source/Commands/CommandObjectMemory.cpp +++ lldb/source/Commands/CommandObjectMemory.cpp @@ -382,7 +382,6 @@ if (view_as_type_cstr && view_as_type_cstr[0]) { // We are viewing memory as a type - SymbolContext sc; const bool exact_match = false; TypeList type_list; uint32_t reference_count = 0; @@ -467,17 +466,13 @@ llvm::DenseSet searched_symbol_files; ConstString lookup_type_name(type_str.c_str()); StackFrame *frame = m_exe_ctx.GetFramePtr(); + ModuleSP search_first; if (frame) { - sc = frame->GetSymbolContext(eSymbolContextModule); - if (sc.module_sp) { - sc.module_sp->FindTypes(sc, lookup_type_name, exact_match, 1, - searched_symbol_files, type_list); - } - } - if (type_list.GetSize() == 0) { - target->GetImages().FindTypes(sc, lookup_type_name, exact_match, 1, - searched_symbol_files, type_list); + search_first = frame->GetSymbolContext(eSymbolContextModule).module_sp; } + target->GetImages().FindTypes(search_first.get(), lookup_type_name, + exact_match, 1, searched_symbol_files, + type_list); if (type_list.GetSize() == 0 && lookup_type_name.GetCString() && *lookup_type_name.GetCString() == '$') { Index: lldb/source/Commands/CommandObjectTarget.cpp =================================================================== --- lldb/source/Commands/CommandObjectTarget.cpp +++ lldb/source/Commands/CommandObjectTarget.cpp @@ -1672,12 +1672,11 @@ const uint32_t max_num_matches = UINT32_MAX; size_t num_matches = 0; bool name_is_fully_qualified = false; - SymbolContext sc; ConstString name(name_cstr); llvm::DenseSet searched_symbol_files; num_matches = - module->FindTypes(sc, name, name_is_fully_qualified, max_num_matches, + module->FindTypes(name, name_is_fully_qualified, max_num_matches, searched_symbol_files, type_list); if (num_matches) { @@ -1715,11 +1714,8 @@ } static size_t LookupTypeHere(CommandInterpreter &interpreter, Stream &strm, - const SymbolContext &sym_ctx, - const char *name_cstr, bool name_is_regex) { - if (!sym_ctx.module_sp) - return 0; - + Module &module, const char *name_cstr, + bool name_is_regex) { TypeList type_list; const uint32_t max_num_matches = UINT32_MAX; size_t num_matches = 1; @@ -1727,14 +1723,13 @@ ConstString name(name_cstr); llvm::DenseSet searched_symbol_files; - num_matches = sym_ctx.module_sp->FindTypes( - sym_ctx, name, name_is_fully_qualified, max_num_matches, - searched_symbol_files, type_list); + num_matches = module.FindTypes(name, name_is_fully_qualified, max_num_matches, + searched_symbol_files, type_list); if (num_matches) { strm.Indent(); strm.PutCString("Best match found in "); - DumpFullpath(strm, &sym_ctx.module_sp->GetFileSpec(), 0); + DumpFullpath(strm, &module.GetFileSpec(), 0); strm.PutCString(":\n"); TypeSP type_sp(type_list.GetTypeAtIndex(0)); @@ -3832,8 +3827,9 @@ return false; case eLookupTypeType: if (!m_options.m_str.empty()) { - if (LookupTypeHere(m_interpreter, result.GetOutputStream(), sym_ctx, - m_options.m_str.c_str(), m_options.m_use_regex)) { + if (LookupTypeHere(m_interpreter, result.GetOutputStream(), + *sym_ctx.module_sp, m_options.m_str.c_str(), + m_options.m_use_regex)) { result.SetStatus(eReturnStatusSuccessFinishResult); return true; } Index: lldb/source/Core/Module.cpp =================================================================== --- lldb/source/Core/Module.cpp +++ lldb/source/Core/Module.cpp @@ -943,33 +943,33 @@ } 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 &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 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 @@ TypeList type_list; llvm::DenseSet 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 &searched_symbol_files, TypeList &types) { size_t num_matches = 0; @@ -1006,8 +1005,8 @@ 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 @@ 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 @@ } } } - if (num_matches > 0) + if (num_matches > 0) { + SymbolContext sc; + sc.module_sp = shared_from_this(); sc.SortTypeList(typesmap, types); + } return num_matches; } Index: lldb/source/Core/ModuleList.cpp =================================================================== --- lldb/source/Core/ModuleList.cpp +++ lldb/source/Core/ModuleList.cpp @@ -542,7 +542,7 @@ } size_t -ModuleList::FindTypes(const SymbolContext &sc, const ConstString &name, +ModuleList::FindTypes(Module *search_first, const ConstString &name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet &searched_symbol_files, TypeList &types) const { @@ -550,14 +550,12 @@ size_t total_matches = 0; collection::const_iterator pos, end = m_modules.end(); - if (sc.module_sp) { - // The symbol context "sc" contains a module so we want to search that one - // first if it is in our list... + if (search_first) { for (pos = m_modules.begin(); pos != end; ++pos) { - if (sc.module_sp.get() == (*pos).get()) { + if (search_first == pos->get()) { total_matches += - (*pos)->FindTypes(sc, name, name_is_fully_qualified, max_matches, - searched_symbol_files, types); + search_first->FindTypes(name, name_is_fully_qualified, max_matches, + searched_symbol_files, types); if (total_matches >= max_matches) break; @@ -566,15 +564,14 @@ } if (total_matches < max_matches) { - SymbolContext world_sc; for (pos = m_modules.begin(); pos != end; ++pos) { // Search the module if the module is not equal to the one in the symbol // context "sc". If "sc" contains a empty module shared pointer, then the // comparison will always be true (valid_module_ptr != nullptr). - if (sc.module_sp.get() != (*pos).get()) + if (search_first != pos->get()) total_matches += - (*pos)->FindTypes(world_sc, name, name_is_fully_qualified, - max_matches, searched_symbol_files, types); + (*pos)->FindTypes(name, name_is_fully_qualified, max_matches, + searched_symbol_files, types); if (total_matches >= max_matches) break; Index: lldb/source/DataFormatters/TypeFormat.cpp =================================================================== --- lldb/source/DataFormatters/TypeFormat.cpp +++ lldb/source/DataFormatters/TypeFormat.cpp @@ -159,11 +159,10 @@ if (!target_sp) return false; const ModuleList &images(target_sp->GetImages()); - SymbolContext sc; TypeList types; llvm::DenseSet searched_symbol_files; - images.FindTypes(sc, m_enum_type, false, UINT32_MAX, searched_symbol_files, - types); + images.FindTypes(nullptr, m_enum_type, false, UINT32_MAX, + searched_symbol_files, types); if (types.GetSize() == 0) return false; for (lldb::TypeSP type_sp : types.Types()) { Index: lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -332,11 +332,9 @@ TypeList types; - SymbolContext null_sc; ConstString name(tag_decl->getName().str().c_str()); - i->first->FindTypesInNamespace(null_sc, name, &i->second, UINT32_MAX, - types); + i->first->FindTypesInNamespace(name, &i->second, UINT32_MAX, types); for (uint32_t ti = 0, te = types.GetSize(); ti != te && !found; ++ti) { lldb::TypeSP type = types.GetTypeAtIndex(ti); @@ -366,7 +364,6 @@ } else { TypeList types; - SymbolContext null_sc; ConstString name(tag_decl->getName().str().c_str()); CompilerDeclContext namespace_decl; @@ -374,7 +371,7 @@ bool exact_match = false; llvm::DenseSet searched_symbol_files; - module_list.FindTypes(null_sc, name, exact_match, UINT32_MAX, + module_list.FindTypes(nullptr, name, exact_match, UINT32_MAX, searched_symbol_files, types); for (uint32_t ti = 0, te = types.GetSize(); ti != te && !found; ++ti) { @@ -854,15 +851,12 @@ break; TypeList types; - SymbolContext null_sc; const bool exact_match = true; llvm::DenseSet searched_symbol_files; if (module_sp && namespace_decl) - module_sp->FindTypesInNamespace(null_sc, name, &namespace_decl, 1, types); + module_sp->FindTypesInNamespace(name, &namespace_decl, 1, types); else { - SymbolContext sc; - sc.module_sp = module_sp; - m_target->GetImages().FindTypes(sc, name, exact_match, 1, + m_target->GetImages().FindTypes(module_sp.get(), name, exact_match, 1, searched_symbol_files, types); } Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -101,7 +101,7 @@ llvm::DenseSet searched_symbol_files; if (sc.module_sp) { num_matches = sc.module_sp->FindTypes( - sc, ConstString(lookup_name), exact_match, 1, + ConstString(lookup_name), exact_match, 1, searched_symbol_files, class_types); } @@ -109,7 +109,7 @@ // list in the target and get as many unique matches as possible if (num_matches == 0) { num_matches = target.GetImages().FindTypes( - sc, ConstString(lookup_name), exact_match, UINT32_MAX, + nullptr, ConstString(lookup_name), exact_match, UINT32_MAX, searched_symbol_files, class_types); } Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -558,7 +558,7 @@ LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? if (log) - log->Printf("AppleObjCDeclVendor::FindTypes [%u] ('%s', %s, %u, )", + log->Printf("AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )", current_id, (const char *)name.AsCString(), append ? "true" : "false", max_matches); Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h =================================================================== --- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h +++ lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h @@ -113,7 +113,7 @@ uint32_t FindFunctions(const RegularExpression ®ex, bool include_inlines, bool append, SymbolContextList &sc_list) override; - uint32_t FindTypes(const SymbolContext &sc, const ConstString &name, + uint32_t FindTypes(const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -153,10 +153,9 @@ } uint32_t SymbolFileBreakpad::FindTypes( - const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, llvm::DenseSet &searched_symbol_files, - TypeMap &types) { + const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeMap &types) { if (!append) types.Clear(); return types.GetSize(); Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -193,8 +193,7 @@ std::vector &mangled_names) override; uint32_t - FindTypes(const lldb_private::SymbolContext &sc, - const lldb_private::ConstString &name, + FindTypes(const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2437,9 +2437,8 @@ } uint32_t SymbolFileDWARF::FindTypes( - const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, + const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap &types) { // If we aren't appending the results to this list, then clear the list @@ -2528,8 +2527,8 @@ SymbolVendor *sym_vendor = external_module_sp->GetSymbolVendor(); if (sym_vendor) { const uint32_t num_external_matches = - sym_vendor->FindTypes(sc, name, parent_decl_ctx, append, - max_matches, searched_symbol_files, types); + sym_vendor->FindTypes(name, parent_decl_ctx, append, max_matches, + searched_symbol_files, types); if (num_external_matches) return num_external_matches; } Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -116,8 +116,7 @@ bool include_inlines, bool append, lldb_private::SymbolContextList &sc_list) override; uint32_t - FindTypes(const lldb_private::SymbolContext &sc, - const lldb_private::ConstString &name, + FindTypes(const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -1180,9 +1180,8 @@ } uint32_t SymbolFileDWARFDebugMap::FindTypes( - const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, + const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap &types) { if (!append) @@ -1191,18 +1190,11 @@ const uint32_t initial_types_size = types.GetSize(); SymbolFileDWARF *oso_dwarf; - if (sc.comp_unit) { - oso_dwarf = GetSymbolFile(sc); - if (oso_dwarf) - return oso_dwarf->FindTypes(sc, name, parent_decl_ctx, append, - max_matches, searched_symbol_files, types); - } else { - ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { - oso_dwarf->FindTypes(sc, name, parent_decl_ctx, append, max_matches, - searched_symbol_files, types); - return types.GetSize() >= max_matches; - }); - } + ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { + oso_dwarf->FindTypes(name, parent_decl_ctx, append, max_matches, + searched_symbol_files, types); + return types.GetSize() >= max_matches; + }); return types.GetSize() - initial_types_size; } Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h =================================================================== --- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h +++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h @@ -139,7 +139,7 @@ uint32_t FindFunctions(const RegularExpression ®ex, bool include_inlines, bool append, SymbolContextList &sc_list) override; - uint32_t FindTypes(const SymbolContext &sc, const ConstString &name, + uint32_t FindTypes(const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -1219,10 +1219,9 @@ } uint32_t SymbolFileNativePDB::FindTypes( - const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, llvm::DenseSet &searched_symbol_files, - TypeMap &types) { + const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeMap &types) { if (!append) types.Clear(); if (!name) Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h =================================================================== --- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h +++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h @@ -137,8 +137,7 @@ void AddSymbols(lldb_private::Symtab &symtab) override; uint32_t - FindTypes(const lldb_private::SymbolContext &sc, - const lldb_private::ConstString &name, + FindTypes(const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -1376,7 +1376,6 @@ } uint32_t SymbolFilePDB::FindTypes( - const lldb_private::SymbolContext &sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, Index: lldb/source/Symbol/SymbolFile.cpp =================================================================== --- lldb/source/Symbol/SymbolFile.cpp +++ lldb/source/Symbol/SymbolFile.cpp @@ -140,9 +140,8 @@ } uint32_t SymbolFile::FindTypes( - const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, + const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap &types) { if (!append) Index: lldb/source/Symbol/SymbolVendor.cpp =================================================================== --- lldb/source/Symbol/SymbolVendor.cpp +++ lldb/source/Symbol/SymbolVendor.cpp @@ -310,15 +310,15 @@ } size_t SymbolVendor::FindTypes( - 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 &searched_symbol_files, TypeMap &types) { ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); if (m_sym_file_ap.get()) - return m_sym_file_ap->FindTypes(sc, name, parent_decl_ctx, append, + return m_sym_file_ap->FindTypes(name, parent_decl_ctx, append, max_matches, searched_symbol_files, types); } Index: lldb/source/Target/Language.cpp =================================================================== --- lldb/source/Target/Language.cpp +++ lldb/source/Target/Language.cpp @@ -385,11 +385,10 @@ Target *target = exe_scope->CalculateTarget().get(); if (target) { const auto &images(target->GetImages()); - SymbolContext null_sc; ConstString cs_key(key); llvm::DenseSet searched_sym_files; TypeList matches; - images.FindTypes(null_sc, cs_key, false, UINT32_MAX, searched_sym_files, + images.FindTypes(nullptr, cs_key, false, UINT32_MAX, searched_sym_files, matches); for (const auto &match : matches.Types()) { if (match.get()) { Index: lldb/source/Target/ObjCLanguageRuntime.cpp =================================================================== --- lldb/source/Target/ObjCLanguageRuntime.cpp +++ lldb/source/Target/ObjCLanguageRuntime.cpp @@ -108,14 +108,13 @@ if (!module_sp) return TypeSP(); - const SymbolContext null_sc; const bool exact_match = true; const uint32_t max_matches = UINT32_MAX; TypeList types; llvm::DenseSet searched_symbol_files; const uint32_t num_types = module_sp->FindTypes( - null_sc, name, exact_match, max_matches, searched_symbol_files, types); + name, exact_match, max_matches, searched_symbol_files, types); if (num_types) { uint32_t i; Index: lldb/tools/lldb-test/lldb-test.cpp =================================================================== --- lldb/tools/lldb-test/lldb-test.cpp +++ lldb/tools/lldb-test/lldb-test.cpp @@ -459,10 +459,9 @@ CompilerDeclContext *ContextPtr = ContextOr->IsValid() ? &*ContextOr : nullptr; - SymbolContext SC; DenseSet SearchedFiles; TypeMap Map; - Vendor.FindTypes(SC, ConstString(Name), ContextPtr, true, UINT32_MAX, + Vendor.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX, SearchedFiles, Map); outs() << formatv("Found {0} types:\n", Map.GetSize()); Index: lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp =================================================================== --- lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp +++ lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp @@ -366,10 +366,9 @@ SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class"), nullptr, false, 0, + EXPECT_EQ(1u, symfile->FindTypes(ConstString("Class"), nullptr, false, 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP udt_type = results.GetTypeAtIndex(0); @@ -389,7 +388,6 @@ SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; @@ -397,7 +395,7 @@ symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus)); EXPECT_NE(nullptr, clang_ast_ctx); - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class"), nullptr, false, 0, + EXPECT_EQ(1u, symfile->FindTypes(ConstString("Class"), nullptr, false, 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); @@ -416,7 +414,7 @@ // compiler type for both, but `FindTypes` may return more than one type // (with the same compiler type) because the symbols have different IDs. auto ClassCompilerDeclCtx = CompilerDeclContext(clang_ast_ctx, ClassDeclCtx); - EXPECT_LE(1u, symfile->FindTypes(sc, ConstString("NestedClass"), + EXPECT_LE(1u, symfile->FindTypes(ConstString("NestedClass"), &ClassCompilerDeclCtx, false, 0, searched_files, results)); EXPECT_LE(1u, results.GetSize()); @@ -459,9 +457,8 @@ auto ns_namespace = symfile->FindNamespace(ConstString("NS"), nullptr); EXPECT_TRUE(ns_namespace.IsValid()); - SymbolContext sc; - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("NSClass"), &ns_namespace, - false, 0, searched_files, results)); + EXPECT_EQ(1u, symfile->FindTypes(ConstString("NSClass"), &ns_namespace, false, + 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP udt_type = results.GetTypeAtIndex(0); @@ -483,12 +480,11 @@ SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; const char *EnumsToCheck[] = {"Enum", "ShortEnum"}; for (auto Enum : EnumsToCheck) { TypeMap results; - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Enum), nullptr, false, 0, + EXPECT_EQ(1u, symfile->FindTypes(ConstString(Enum), nullptr, false, 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP enum_type = results.GetTypeAtIndex(0); @@ -530,7 +526,6 @@ SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; @@ -539,8 +534,8 @@ "VariadicFuncPointerTypedef"}; for (auto Typedef : TypedefsToCheck) { TypeMap results; - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Typedef), nullptr, false, - 0, searched_files, results)); + EXPECT_EQ(1u, symfile->FindTypes(ConstString(Typedef), nullptr, false, 0, + searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP typedef_type = results.GetTypeAtIndex(0); EXPECT_EQ(ConstString(Typedef), typedef_type->GetName()); @@ -584,12 +579,11 @@ SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; const ConstString name("ClassTypedef"); uint32_t num_results = - symfile->FindTypes(sc, name, nullptr, false, 0, searched_files, results); + symfile->FindTypes(name, nullptr, false, 0, searched_files, results); // Try to limit ourselves from 1 to 10 results, otherwise we could be doing // this thousands of times. // The idea is just to make sure that for a variety of values, the number of @@ -597,8 +591,8 @@ // comes out to the number we are expecting. uint32_t iterations = std::min(num_results, 10u); for (uint32_t i = 1; i <= iterations; ++i) { - uint32_t num_limited_results = symfile->FindTypes( - sc, name, nullptr, false, i, searched_files, results); + uint32_t num_limited_results = + symfile->FindTypes(name, nullptr, false, i, searched_files, results); EXPECT_EQ(i, num_limited_results); EXPECT_EQ(num_limited_results, results.GetSize()); } @@ -612,11 +606,10 @@ SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; - uint32_t num_results = symfile->FindTypes(sc, ConstString(), nullptr, false, - 0, searched_files, results); + uint32_t num_results = symfile->FindTypes(ConstString(), nullptr, false, 0, + searched_files, results); EXPECT_EQ(0u, num_results); EXPECT_EQ(0u, results.GetSize()); }