lassefolger updated this revision to Diff 390001.
lassefolger added a comment.
rebased on nfc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114627/new/
https://reviews.llvm.org/D114627
Files:
lldb/include/lldb/Symbol/SymbolFile.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Symbol/SymbolFile.cpp
Index: lldb/source/Symbol/SymbolFile.cpp
===================================================================
--- lldb/source/Symbol/SymbolFile.cpp
+++ lldb/source/Symbol/SymbolFile.cpp
@@ -135,6 +135,19 @@
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types) {}
+void SymbolFile::FindTypes(
+ ConstString basename, ConstString scope,
+ const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches,
+ llvm::DenseSet<lldb_private::SymbolFile *> &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<CompilerContext> pattern,
LanguageSet languages,
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -191,6 +191,13 @@
const std::string &scope_qualified_name,
std::vector<lldb_private::ConstString> &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<lldb_private::SymbolFile *> &searched_symbol_files,
+ lldb_private::TypeMap &types) override;
+
void
FindTypes(lldb_private::ConstString name,
const lldb_private::CompilerDeclContext &parent_decl_ctx,
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ 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<lldb_private::SymbolFile *> &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<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types) {
std::lock_guard<std::recursive_mutex> 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;
Index: lldb/include/lldb/Symbol/SymbolFile.h
===================================================================
--- lldb/include/lldb/Symbol/SymbolFile.h
+++ lldb/include/lldb/Symbol/SymbolFile.h
@@ -235,6 +235,15 @@
llvm::DenseSet<lldb_private::SymbolFile *> &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<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
+
/// Find types specified by a CompilerContextPattern.
/// \param languages
/// Only return results in these languages.
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits