diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -235,6 +235,15 @@ llvm::DenseSet &searched_symbol_files, TypeMap &types); + // Find types in a specific scope. + // \param scope + // Must be either the fully qualified scope (without leading ::) or empty + virtual void + FindTypes(ConstString name, ConstString scope, + const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, + TypeMap &types); + /// Find types specified by a CompilerContextPattern. /// \param languages /// Only return results in these languages. diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -191,6 +191,13 @@ const std::string &scope_qualified_name, std::vector &mangled_names) override; + void + FindTypes(lldb_private::ConstString name, lldb_private::ConstString scope, + const lldb_private::CompilerDeclContext &parent_decl_ctx, + uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, + lldb_private::TypeMap &types) override; + void FindTypes(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -21,6 +21,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Core/Value.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/ConstString.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/StreamString.h" @@ -2419,6 +2420,15 @@ uint32_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap &types) { + FindTypes(name, ConstString(), parent_decl_ctx, max_matches, + searched_symbol_files, types); +} + +void SymbolFileDWARF::FindTypes( + ConstString name, ConstString scope, + const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, + TypeMap &types) { std::lock_guard guard(GetModuleMutex()); // Make sure we haven't already searched this SymbolFile before. if (!searched_symbol_files.insert(this).second) @@ -2445,10 +2455,16 @@ if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx)) return; + const char *sc = scope.AsCString(""); + std::string s; m_index->GetTypes(name, [&](DWARFDIE die) { if (!DIEInDeclContext(parent_decl_ctx, die)) return true; // The containing decl contexts don't match + const char *qn = die.GetQualifiedName(s); + if (strncmp(sc, qn, strlen(sc))) + return true; + Type *matching_type = ResolveType(die, true, true); if (!matching_type) return true; diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp --- a/lldb/source/Symbol/SymbolFile.cpp +++ b/lldb/source/Symbol/SymbolFile.cpp @@ -135,6 +135,19 @@ llvm::DenseSet &searched_symbol_files, TypeMap &types) {} +void SymbolFile::FindTypes( + ConstString basename, ConstString scope, + const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, + TypeMap &types) { + FindTypes(basename, parent_decl_ctx, max_matches, searched_symbol_files, + types); + TypeClass type_class = eTypeClassAny; + types.RemoveMismatchedTypes(std::string(basename.GetCString()), + std::string(scope.GetCString()), type_class, + true); +} + void SymbolFile::FindTypes(llvm::ArrayRef pattern, LanguageSet languages, llvm::DenseSet &searched_symbol_files,