[Lldb-commits] [lldb] r373344 - Remove size_t return parameter from FindTypes
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 1 08:40:41 PDT 2019
Author: adrian
Date: Tue Oct 1 08:40:41 2019
New Revision: 373344
URL: http://llvm.org/viewvc/llvm-project?rev=373344&view=rev
Log:
Remove size_t return parameter from FindTypes
In r368345 I accidentally introduced a regression that would
over-report the number of matches found by FindTypes if the
DeclContext Filter was hit.
This patch simply removes the size_t return parameter altogether —
it's not that useful.
rdar://problem/55500457
Differential Revision: https://reviews.llvm.org/D68169
Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/ModuleList.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/TypeList.h
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Oct 1 08:40:41 2019
@@ -447,9 +447,7 @@ public:
/// \param[out] type_list
/// A type list gets populated with any matches.
///
- /// \return
- /// The number of matches added to \a type_list.
- size_t
+ void
FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeList &types);
@@ -459,8 +457,8 @@ public:
/// This behaves like the other FindTypes method but allows to
/// specify a DeclContext and a language for the type being searched
/// for.
- size_t FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, TypeMap &types);
+ void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
+ TypeMap &types);
lldb::TypeSP FindFirstType(const SymbolContext &sc,
ConstString type_name, bool exact_match);
@@ -479,11 +477,9 @@ public:
/// \param[out] type_list
/// A type list gets populated with any matches.
///
- /// \return
- /// The number of matches added to \a type_list.
- size_t FindTypesInNamespace(ConstString type_name,
- const CompilerDeclContext *parent_decl_ctx,
- size_t max_matches, TypeList &type_list);
+ void FindTypesInNamespace(ConstString type_name,
+ const CompilerDeclContext *parent_decl_ctx,
+ size_t max_matches, TypeList &type_list);
/// Get const accessor for the module architecture.
///
@@ -1074,7 +1070,7 @@ protected:
private:
Module(); // Only used internally by CreateJITModule ()
- size_t FindTypes_Impl(
+ void FindTypes_Impl(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Tue Oct 1 08:40:41 2019
@@ -393,12 +393,10 @@ public:
/// \param[out] type_list
/// A type list gets populated with any matches.
///
- /// \return
- /// The number of matches added to \a type_list.
- size_t FindTypes(Module *search_first, ConstString name,
- bool name_is_fully_qualified, size_t max_matches,
- llvm::DenseSet<SymbolFile *> &searched_symbol_files,
- TypeList &types) const;
+ void FindTypes(Module *search_first, ConstString name,
+ bool name_is_fully_qualified, size_t max_matches,
+ llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeList &types) const;
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Tue Oct 1 08:40:41 2019
@@ -188,7 +188,7 @@ public:
virtual uint32_t FindFunctions(const RegularExpression ®ex,
bool include_inlines, bool append,
SymbolContextList &sc_list);
- virtual uint32_t
+ virtual void
FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
@@ -196,16 +196,16 @@ public:
/// Find types specified by a CompilerContextPattern.
/// \param languages Only return results in these languages.
- virtual size_t FindTypes(llvm::ArrayRef<CompilerContext> pattern,
+ virtual void FindTypes(llvm::ArrayRef<CompilerContext> pattern,
LanguageSet languages, TypeMap &types);
virtual void
GetMangledNamesForFunction(const std::string &scope_qualified_name,
std::vector<ConstString> &mangled_names);
- virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- lldb_private::TypeList &type_list) = 0;
+ virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ lldb_private::TypeList &type_list) = 0;
virtual void PreloadSymbols();
Modified: lldb/trunk/include/lldb/Symbol/TypeList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeList.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeList.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeList.h Tue Oct 1 08:40:41 2019
@@ -28,15 +28,14 @@ public:
void Dump(Stream *s, bool show_context);
- // lldb::TypeSP
- // FindType(lldb::user_id_t uid);
-
TypeList FindTypes(ConstString name);
void Insert(const lldb::TypeSP &type);
uint32_t GetSize() const;
+ bool Empty() const { return !GetSize(); }
+
lldb::TypeSP GetTypeAtIndex(uint32_t idx);
typedef std::vector<lldb::TypeSP> collection;
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Tue Oct 1 08:40:41 2019
@@ -503,16 +503,10 @@ lldb::SBTypeList SBModule::FindTypes(con
const bool exact_match = false;
ConstString name(type);
llvm::DenseSet<SymbolFile *> searched_symbol_files;
- const uint32_t num_matches = module_sp->FindTypes(
- name, exact_match, UINT32_MAX, searched_symbol_files, type_list);
+ module_sp->FindTypes(name, exact_match, UINT32_MAX, searched_symbol_files,
+ type_list);
- if (num_matches > 0) {
- for (size_t idx = 0; idx < num_matches; idx++) {
- TypeSP type_sp(type_list.GetTypeAtIndex(idx));
- if (type_sp)
- retval.Append(SBType(type_sp));
- }
- } else {
+ if (type_list.Empty()) {
auto type_system_or_err =
module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
if (auto err = type_system_or_err.takeError()) {
@@ -523,9 +517,14 @@ lldb::SBTypeList SBModule::FindTypes(con
if (compiler_type)
retval.Append(SBType(compiler_type));
}
+ } else {
+ for (size_t idx = 0; idx < type_list.GetSize(); idx++) {
+ TypeSP type_sp(type_list.GetTypeAtIndex(idx));
+ if (type_sp)
+ retval.Append(SBType(type_sp));
+ }
}
}
-
return LLDB_RECORD_RESULT(retval);
}
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Tue Oct 1 08:40:41 2019
@@ -1891,16 +1891,13 @@ lldb::SBTypeList SBTarget::FindTypes(con
bool exact_match = false;
TypeList type_list;
llvm::DenseSet<SymbolFile *> searched_symbol_files;
- uint32_t num_matches =
- images.FindTypes(nullptr, const_typename, exact_match, UINT32_MAX,
- searched_symbol_files, type_list);
+ images.FindTypes(nullptr, const_typename, exact_match, UINT32_MAX,
+ searched_symbol_files, type_list);
- if (num_matches > 0) {
- for (size_t idx = 0; idx < num_matches; idx++) {
- TypeSP type_sp(type_list.GetTypeAtIndex(idx));
- if (type_sp)
- sb_type_list.Append(SBType(type_sp));
- }
+ for (size_t idx = 0; idx < type_list.GetSize(); idx++) {
+ TypeSP type_sp(type_list.GetTypeAtIndex(idx));
+ if (type_sp)
+ sb_type_list.Append(SBType(type_sp));
}
// Try the loaded language runtimes
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Oct 1 08:40:41 2019
@@ -1629,75 +1629,30 @@ static size_t LookupFunctionInModule(Com
static size_t LookupTypeInModule(CommandInterpreter &interpreter, Stream &strm,
Module *module, const char *name_cstr,
bool name_is_regex) {
+ TypeList type_list;
if (module && name_cstr && name_cstr[0]) {
- TypeList type_list;
const uint32_t max_num_matches = UINT32_MAX;
size_t num_matches = 0;
bool name_is_fully_qualified = false;
ConstString name(name_cstr);
llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
- num_matches =
- module->FindTypes(name, name_is_fully_qualified, max_num_matches,
- searched_symbol_files, type_list);
-
- if (num_matches) {
- strm.Indent();
- strm.Printf("%" PRIu64 " match%s found in ", (uint64_t)num_matches,
- num_matches > 1 ? "es" : "");
- DumpFullpath(strm, &module->GetFileSpec(), 0);
- strm.PutCString(":\n");
- for (TypeSP type_sp : type_list.Types()) {
- if (type_sp) {
- // Resolve the clang type so that any forward references to types
- // that haven't yet been parsed will get parsed.
- type_sp->GetFullCompilerType();
- type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
- // Print all typedef chains
- TypeSP typedef_type_sp(type_sp);
- TypeSP typedefed_type_sp(typedef_type_sp->GetTypedefType());
- while (typedefed_type_sp) {
- strm.EOL();
- strm.Printf(" typedef '%s': ",
- typedef_type_sp->GetName().GetCString());
- typedefed_type_sp->GetFullCompilerType();
- typedefed_type_sp->GetDescription(&strm, eDescriptionLevelFull,
- true);
- typedef_type_sp = typedefed_type_sp;
- typedefed_type_sp = typedef_type_sp->GetTypedefType();
- }
- }
- strm.EOL();
- }
- }
- return num_matches;
- }
- return 0;
-}
-
-static size_t LookupTypeHere(CommandInterpreter &interpreter, Stream &strm,
- 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;
- bool name_is_fully_qualified = false;
+ module->FindTypes(name, name_is_fully_qualified, max_num_matches,
+ searched_symbol_files, type_list);
- ConstString name(name_cstr);
- llvm::DenseSet<SymbolFile *> searched_symbol_files;
- num_matches = module.FindTypes(name, name_is_fully_qualified, max_num_matches,
- searched_symbol_files, type_list);
+ if (type_list.Empty())
+ return 0;
- if (num_matches) {
strm.Indent();
- strm.PutCString("Best match found in ");
- DumpFullpath(strm, &module.GetFileSpec(), 0);
+ strm.Printf("%" PRIu64 " match%s found in ", (uint64_t)num_matches,
+ num_matches > 1 ? "es" : "");
+ DumpFullpath(strm, &module->GetFileSpec(), 0);
strm.PutCString(":\n");
-
- TypeSP type_sp(type_list.GetTypeAtIndex(0));
- if (type_sp) {
- // Resolve the clang type so that any forward references to types that
- // haven't yet been parsed will get parsed.
+ for (TypeSP type_sp : type_list.Types()) {
+ if (!type_sp)
+ continue;
+ // Resolve the clang type so that any forward references to types
+ // that haven't yet been parsed will get parsed.
type_sp->GetFullCompilerType();
type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
// Print all typedef chains
@@ -1715,7 +1670,50 @@ static size_t LookupTypeHere(CommandInte
}
strm.EOL();
}
- return num_matches;
+ return type_list.GetSize();
+}
+
+static size_t LookupTypeHere(CommandInterpreter &interpreter, Stream &strm,
+ Module &module, const char *name_cstr,
+ bool name_is_regex) {
+ TypeList type_list;
+ const uint32_t max_num_matches = UINT32_MAX;
+ bool name_is_fully_qualified = false;
+
+ ConstString name(name_cstr);
+ llvm::DenseSet<SymbolFile *> searched_symbol_files;
+ module.FindTypes(name, name_is_fully_qualified, max_num_matches,
+ searched_symbol_files, type_list);
+
+ if (type_list.Empty())
+ return 0;
+
+ strm.Indent();
+ strm.PutCString("Best match found in ");
+ DumpFullpath(strm, &module.GetFileSpec(), 0);
+ strm.PutCString(":\n");
+
+ TypeSP type_sp(type_list.GetTypeAtIndex(0));
+ if (type_sp) {
+ // Resolve the clang type so that any forward references to types that
+ // haven't yet been parsed will get parsed.
+ type_sp->GetFullCompilerType();
+ type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
+ // Print all typedef chains
+ TypeSP typedef_type_sp(type_sp);
+ TypeSP typedefed_type_sp(typedef_type_sp->GetTypedefType());
+ while (typedefed_type_sp) {
+ strm.EOL();
+ strm.Printf(" typedef '%s': ",
+ typedef_type_sp->GetName().GetCString());
+ typedefed_type_sp->GetFullCompilerType();
+ typedefed_type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
+ typedef_type_sp = typedefed_type_sp;
+ typedefed_type_sp = typedef_type_sp->GetTypedefType();
+ }
+ }
+ strm.EOL();
+ return type_list.GetSize();
}
static uint32_t LookupFileAndLineInModule(CommandInterpreter &interpreter,
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue Oct 1 08:40:41 2019
@@ -939,7 +939,7 @@ void Module::FindAddressesForLine(const
}
}
-size_t Module::FindTypes_Impl(
+void Module::FindTypes_Impl(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
@@ -947,42 +947,38 @@ size_t Module::FindTypes_Impl(
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, max_matches,
- searched_symbol_files, types);
- return 0;
+ symbols->FindTypes(name, parent_decl_ctx, max_matches,
+ searched_symbol_files, types);
}
-size_t Module::FindTypesInNamespace(ConstString type_name,
- const CompilerDeclContext *parent_decl_ctx,
- size_t max_matches, TypeList &type_list) {
+void Module::FindTypesInNamespace(ConstString type_name,
+ const CompilerDeclContext *parent_decl_ctx,
+ size_t max_matches, TypeList &type_list) {
TypeMap types_map;
llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
- size_t num_types = FindTypes_Impl(type_name, parent_decl_ctx, max_matches,
- searched_symbol_files, types_map);
- if (num_types > 0) {
+ FindTypes_Impl(type_name, parent_decl_ctx, max_matches, searched_symbol_files,
+ types_map);
+ if (types_map.GetSize()) {
SymbolContext sc;
sc.module_sp = shared_from_this();
sc.SortTypeList(types_map, type_list);
}
- return num_types;
}
lldb::TypeSP Module::FindFirstType(const SymbolContext &sc,
ConstString name, bool exact_match) {
TypeList type_list;
llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
- const size_t num_matches =
- FindTypes(name, exact_match, 1, searched_symbol_files, type_list);
- if (num_matches)
+ FindTypes(name, exact_match, 1, searched_symbol_files, type_list);
+ if (type_list.GetSize())
return type_list.GetTypeAtIndex(0);
return TypeSP();
}
-size_t Module::FindTypes(
+void Module::FindTypes(
ConstString name, bool exact_match, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeList &types) {
- size_t num_matches = 0;
const char *type_name_cstr = name.GetCString();
llvm::StringRef type_scope;
llvm::StringRef type_basename;
@@ -998,12 +994,11 @@ 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, max_matches,
- searched_symbol_files, typesmap)) {
+ FindTypes_Impl(type_basename_const_str, nullptr, max_matches,
+ searched_symbol_files, typesmap);
+ if (typesmap.GetSize())
typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
exact_match);
- num_matches = typesmap.GetSize();
- }
} else {
// The type is not in a namespace/class scope, just search for it by
// basename
@@ -1014,33 +1009,28 @@ size_t Module::FindTypes(
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, UINT_MAX,
- searched_symbol_files, typesmap);
+ FindTypes_Impl(name, nullptr, UINT_MAX, searched_symbol_files, typesmap);
if (exact_match) {
std::string name_str(name.AsCString(""));
typesmap.RemoveMismatchedTypes(type_scope, name_str, type_class,
exact_match);
- num_matches = typesmap.GetSize();
}
}
}
- if (num_matches > 0) {
+ if (typesmap.GetSize()) {
SymbolContext sc;
sc.module_sp = shared_from_this();
sc.SortTypeList(typesmap, types);
}
- return num_matches;
}
-size_t Module::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, TypeMap &types) {
+void Module::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
+ 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, types);
- return 0;
+ symbols->FindTypes(pattern, languages, types);
}
SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) {
Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Tue Oct 1 08:40:41 2019
@@ -17,6 +17,7 @@
#include "lldb/Symbol/LocateSymbolFile.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/TypeList.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
@@ -56,9 +57,6 @@ class SymbolFile;
namespace lldb_private {
class Target;
}
-namespace lldb_private {
-class TypeList;
-}
using namespace lldb;
using namespace lldb_private;
@@ -525,44 +523,36 @@ ModuleSP ModuleList::FindModule(const UU
return module_sp;
}
-size_t
-ModuleList::FindTypes(Module *search_first, ConstString name,
- bool name_is_fully_qualified, size_t max_matches,
- llvm::DenseSet<SymbolFile *> &searched_symbol_files,
- TypeList &types) const {
+void ModuleList::FindTypes(Module *search_first, ConstString name,
+ bool name_is_fully_qualified, size_t max_matches,
+ llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeList &types) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- size_t total_matches = 0;
collection::const_iterator pos, end = m_modules.end();
if (search_first) {
for (pos = m_modules.begin(); pos != end; ++pos) {
if (search_first == pos->get()) {
- total_matches +=
- search_first->FindTypes(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;
+ if (types.GetSize() >= max_matches)
+ return;
}
}
}
- if (total_matches < max_matches) {
- 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 (search_first != pos->get())
- total_matches +=
- (*pos)->FindTypes(name, name_is_fully_qualified, max_matches,
- searched_symbol_files, types);
+ 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 (search_first != pos->get())
+ (*pos)->FindTypes(name, name_is_fully_qualified, max_matches,
+ searched_symbol_files, types);
- if (total_matches >= max_matches)
- break;
- }
+ if (types.GetSize() >= max_matches)
+ return;
}
-
- return total_matches;
}
bool ModuleList::FindSourceFile(const FileSpec &orig_spec,
Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Tue Oct 1 08:40:41 2019
@@ -95,31 +95,27 @@ TypeAndOrName ItaniumABILanguageRuntime:
const bool exact_match = true;
TypeList class_types;
- uint32_t num_matches = 0;
// First look in the module that the vtable symbol came from and
// look for a single exact match.
llvm::DenseSet<SymbolFile *> searched_symbol_files;
- if (sc.module_sp) {
- num_matches = sc.module_sp->FindTypes(
- ConstString(lookup_name), exact_match, 1,
- searched_symbol_files, class_types);
- }
+ if (sc.module_sp)
+ sc.module_sp->FindTypes(ConstString(lookup_name), exact_match, 1,
+ searched_symbol_files, class_types);
// If we didn't find a symbol, then move on to the entire module
// list in the target and get as many unique matches as possible
- if (num_matches == 0) {
- num_matches = target.GetImages().FindTypes(
- nullptr, ConstString(lookup_name), exact_match, UINT32_MAX,
- searched_symbol_files, class_types);
- }
+ if (class_types.Empty())
+ target.GetImages().FindTypes(nullptr, ConstString(lookup_name),
+ exact_match, UINT32_MAX,
+ searched_symbol_files, class_types);
lldb::TypeSP type_sp;
- if (num_matches == 0) {
+ if (class_types.Empty()) {
LLDB_LOGF(log, "0x%16.16" PRIx64 ": is not dynamic\n",
original_ptr);
return TypeAndOrName();
}
- if (num_matches == 1) {
+ if (class_types.GetSize() == 1) {
type_sp = class_types.GetTypeAtIndex(0);
if (type_sp) {
if (ClangASTContext::IsCXXClassType(
@@ -134,10 +130,10 @@ TypeAndOrName ItaniumABILanguageRuntime:
type_info.SetTypeSP(type_sp);
}
}
- } else if (num_matches > 1) {
+ } else {
size_t i;
if (log) {
- for (i = 0; i < num_matches; i++) {
+ for (i = 0; i < class_types.GetSize(); i++) {
type_sp = class_types.GetTypeAtIndex(i);
if (type_sp) {
LLDB_LOGF(
@@ -151,7 +147,7 @@ TypeAndOrName ItaniumABILanguageRuntime:
}
}
- for (i = 0; i < num_matches; i++) {
+ for (i = 0; i < class_types.GetSize(); i++) {
type_sp = class_types.GetTypeAtIndex(i);
if (type_sp) {
if (ClangASTContext::IsCXXClassType(
@@ -168,7 +164,7 @@ TypeAndOrName ItaniumABILanguageRuntime:
}
}
- if (log && i == num_matches) {
+ if (log) {
LLDB_LOGF(log,
"0x%16.16" PRIx64
": static-type = '%s' has multiple matching dynamic "
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp Tue Oct 1 08:40:41 2019
@@ -121,20 +121,17 @@ ObjCLanguageRuntime::LookupInCompleteCla
TypeList types;
llvm::DenseSet<SymbolFile *> searched_symbol_files;
- const uint32_t num_types = module_sp->FindTypes(
- name, exact_match, max_matches, searched_symbol_files, types);
+ module_sp->FindTypes(name, exact_match, max_matches, searched_symbol_files,
+ types);
- if (num_types) {
- uint32_t i;
- for (i = 0; i < num_types; ++i) {
- TypeSP type_sp(types.GetTypeAtIndex(i));
+ for (uint32_t i = 0; i < types.GetSize(); ++i) {
+ TypeSP type_sp(types.GetTypeAtIndex(i));
- if (ClangASTContext::IsObjCObjectOrInterfaceType(
- type_sp->GetForwardCompilerType())) {
- if (type_sp->IsCompleteObjCClass()) {
- m_complete_class_cache[name] = type_sp;
- return type_sp;
- }
+ if (ClangASTContext::IsObjCObjectOrInterfaceType(
+ type_sp->GetForwardCompilerType())) {
+ if (type_sp->IsCompleteObjCClass()) {
+ m_complete_class_cache[name] = type_sp;
+ return type_sp;
}
}
}
Modified: lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp Tue Oct 1 08:40:41 2019
@@ -308,17 +308,13 @@ uint32_t SymbolFileBreakpad::FindFunctio
return sc_list.GetSize();
}
-uint32_t SymbolFileBreakpad::FindTypes(
+void SymbolFileBreakpad::FindTypes(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files,
- TypeMap &types) {
- return 0;
-}
+ TypeMap &types) {}
-size_t SymbolFileBreakpad::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, TypeMap &types) {
- return 0;
-}
+void SymbolFileBreakpad::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
+ LanguageSet languages, TypeMap &types) {}
void SymbolFileBreakpad::AddSymbols(Symtab &symtab) {
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS);
Modified: lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h Tue Oct 1 08:40:41 2019
@@ -97,10 +97,8 @@ public:
lldb::SymbolContextItem resolve_scope,
SymbolContextList &sc_list) override;
- size_t GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask,
- TypeList &type_list) override {
- return 0;
- }
+ void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask,
+ TypeList &type_list) override {}
uint32_t FindFunctions(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
@@ -111,14 +109,13 @@ public:
uint32_t FindFunctions(const RegularExpression ®ex, bool include_inlines,
bool append, SymbolContextList &sc_list) override;
- uint32_t FindTypes(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- uint32_t max_matches,
- llvm::DenseSet<SymbolFile *> &searched_symbol_files,
- TypeMap &types) override;
+ void FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
+ uint32_t max_matches,
+ llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeMap &types) override;
- size_t FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, TypeMap &types) override;
+ void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
+ TypeMap &types) override;
llvm::Expected<TypeSystem &>
GetTypeSystemForLanguage(lldb::LanguageType language) override {
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Tue Oct 1 08:40:41 2019
@@ -151,8 +151,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
// The type in the Clang module must have the same langage as the current CU.
LanguageSet languages;
languages.Insert(die.GetCU()->GetLanguageType());
- if (!dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, languages,
- dwo_types)) {
+ dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, languages, dwo_types);
+ if (dwo_types.GetSize()) {
if (!IsClangModuleFwdDecl(die))
return TypeSP();
@@ -162,8 +162,9 @@ TypeSP DWARFASTParserClang::ParseTypeFro
for (const auto &name_module : sym_file.getExternalTypeModules()) {
if (!name_module.second)
continue;
- if (name_module.second->GetSymbolFile()->FindTypes(decl_context,
- languages, dwo_types))
+ name_module.second->GetSymbolFile()->FindTypes(decl_context,
+ languages, dwo_types);
+ if (dwo_types.GetSize())
break;
}
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Oct 1 08:40:41 2019
@@ -335,8 +335,8 @@ void SymbolFileDWARF::GetTypes(const DWA
}
}
-size_t SymbolFileDWARF::GetTypes(SymbolContextScope *sc_scope,
- TypeClass type_mask, TypeList &type_list)
+void SymbolFileDWARF::GetTypes(SymbolContextScope *sc_scope,
+ TypeClass type_mask, TypeList &type_list)
{
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
@@ -349,8 +349,8 @@ size_t SymbolFileDWARF::GetTypes(SymbolC
if (comp_unit) {
dwarf_cu = GetDWARFCompileUnit(comp_unit);
- if (dwarf_cu == nullptr)
- return 0;
+ if (!dwarf_cu)
+ return;
GetTypes(dwarf_cu->DIE(), dwarf_cu->GetOffset(),
dwarf_cu->GetNextUnitOffset(), type_mask, type_set);
} else {
@@ -367,16 +367,13 @@ size_t SymbolFileDWARF::GetTypes(SymbolC
}
std::set<CompilerType> compiler_type_set;
- size_t num_types_added = 0;
for (Type *type : type_set) {
CompilerType compiler_type = type->GetForwardCompilerType();
if (compiler_type_set.find(compiler_type) == compiler_type_set.end()) {
compiler_type_set.insert(compiler_type);
type_list.Insert(type->shared_from_this());
- ++num_types_added;
}
}
- return num_types_added;
}
// Gets the first parent that is a lexical block, function or inlined
@@ -2383,7 +2380,7 @@ void SymbolFileDWARF::GetMangledNamesFor
}
}
-uint32_t SymbolFileDWARF::FindTypes(
+void SymbolFileDWARF::FindTypes(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
@@ -2391,13 +2388,13 @@ uint32_t SymbolFileDWARF::FindTypes(
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
// Make sure we haven't already searched this SymbolFile before...
if (searched_symbol_files.count(this))
- return 0;
- else
- searched_symbol_files.insert(this);
+ return;
+
+ searched_symbol_files.insert(this);
DWARFDebugInfo *info = DebugInfo();
- if (info == nullptr)
- return 0;
+ if (!info)
+ return;
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
@@ -2418,12 +2415,11 @@ uint32_t SymbolFileDWARF::FindTypes(
}
if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
- return 0;
+ return;
DIEArray die_offsets;
m_index->GetTypes(name, die_offsets);
const size_t num_die_matches = die_offsets.size();
- const uint32_t initial_types_size = types.GetSize();
for (size_t i = 0; i < num_die_matches; ++i) {
const DIERef &die_ref = die_offsets[i];
@@ -2458,8 +2454,7 @@ uint32_t SymbolFileDWARF::FindTypes(
searched_symbol_files, types);
}
- uint32_t num_matches = types.GetSize() - initial_types_size;
- if (log && num_matches) {
+ if (log && types.GetSize()) {
if (parent_decl_ctx) {
GetObjectFile()->GetModule()->LogMessage(
log,
@@ -2467,60 +2462,53 @@ uint32_t SymbolFileDWARF::FindTypes(
"= %p (\"%s\"), max_matches=%u, type_list) => %u",
name.GetCString(), static_cast<const void *>(parent_decl_ctx),
parent_decl_ctx->GetName().AsCString("<NULL>"), max_matches,
- num_matches);
+ types.GetSize());
} else {
GetObjectFile()->GetModule()->LogMessage(
log,
"SymbolFileDWARF::FindTypes (sc, name=\"%s\", parent_decl_ctx "
"= NULL, max_matches=%u, type_list) => %u",
- name.GetCString(), max_matches, num_matches);
+ name.GetCString(), max_matches, types.GetSize());
}
}
-
- return num_matches;
}
-size_t SymbolFileDWARF::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
+void SymbolFileDWARF::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
LanguageSet languages, TypeMap &types) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
if (pattern.empty())
- return 0;
+ return;
ConstString name = pattern.back().name;
if (!name)
- return 0;
+ return;
DIEArray die_offsets;
m_index->GetTypes(name, die_offsets);
const size_t num_die_matches = die_offsets.size();
- size_t num_matches = 0;
for (size_t i = 0; i < num_die_matches; ++i) {
const DIERef &die_ref = die_offsets[i];
DWARFDIE die = GetDIE(die_ref);
- if (die) {
- if (!languages[die.GetCU()->GetLanguageType()])
- continue;
-
- llvm::SmallVector<CompilerContext, 4> die_context;
- die.GetDeclContext(die_context);
- if (!contextMatches(die_context, pattern))
- continue;
-
- Type *matching_type = ResolveType(die, true, true);
- if (matching_type) {
- // We found a type pointer, now find the shared pointer form our type
- // list
- types.InsertUnique(matching_type->shared_from_this());
- ++num_matches;
- }
- } else {
+ if (!die) {
m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
+ continue;
}
+ if (!languages[die.GetCU()->GetLanguageType()])
+ continue;
+
+ llvm::SmallVector<CompilerContext, 4> die_context;
+ die.GetDeclContext(die_context);
+ if (!contextMatches(die_context, pattern))
+ continue;
+
+ if (Type *matching_type = ResolveType(die, true, true))
+ // We found a type pointer, now find the shared pointer form our type
+ // list.
+ types.InsertUnique(matching_type->shared_from_this());
}
- return num_matches;
}
CompilerDeclContext
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Oct 1 08:40:41 2019
@@ -181,20 +181,20 @@ public:
const std::string &scope_qualified_name,
std::vector<lldb_private::ConstString> &mangled_names) override;
- uint32_t
+ void
FindTypes(lldb_private::ConstString name,
const lldb_private::CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
lldb_private::TypeMap &types) override;
- size_t FindTypes(llvm::ArrayRef<lldb_private::CompilerContext> pattern,
- lldb_private::LanguageSet languages,
- lldb_private::TypeMap &types) override;
+ void FindTypes(llvm::ArrayRef<lldb_private::CompilerContext> pattern,
+ lldb_private::LanguageSet languages,
+ lldb_private::TypeMap &types) override;
- size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- lldb_private::TypeList &type_list) override;
+ void GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ lldb_private::TypeList &type_list) override;
llvm::Expected<lldb_private::TypeSystem &>
GetTypeSystemForLanguage(lldb::LanguageType language) override;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue Oct 1 08:40:41 2019
@@ -1070,16 +1070,15 @@ uint32_t SymbolFileDWARFDebugMap::FindFu
return sc_list.GetSize() - initial_size;
}
-size_t SymbolFileDWARFDebugMap::GetTypes(SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- TypeList &type_list) {
+void SymbolFileDWARFDebugMap::GetTypes(SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ TypeList &type_list) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat,
"SymbolFileDWARFDebugMap::GetTypes (type_mask = 0x%8.8x)",
type_mask);
- uint32_t initial_size = type_list.GetSize();
SymbolFileDWARF *oso_dwarf = nullptr;
if (sc_scope) {
SymbolContext sc;
@@ -1097,7 +1096,6 @@ size_t SymbolFileDWARFDebugMap::GetTypes
return false;
});
}
- return type_list.GetSize() - initial_size;
}
std::vector<lldb_private::CallEdge>
@@ -1199,21 +1197,17 @@ TypeSP SymbolFileDWARFDebugMap::FindComp
return TypeSP();
}
-uint32_t SymbolFileDWARFDebugMap::FindTypes(
+void SymbolFileDWARFDebugMap::FindTypes(
ConstString name, 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());
- const uint32_t initial_types_size = types.GetSize();
-
ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
oso_dwarf->FindTypes(name, parent_decl_ctx, max_matches,
searched_symbol_files, types);
return types.GetSize() >= max_matches;
});
-
- return types.GetSize() - initial_types_size;
}
//
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Tue Oct 1 08:40:41 2019
@@ -108,7 +108,7 @@ public:
uint32_t FindFunctions(const lldb_private::RegularExpression ®ex,
bool include_inlines, bool append,
lldb_private::SymbolContextList &sc_list) override;
- uint32_t
+ void
FindTypes(lldb_private::ConstString name,
const lldb_private::CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches,
@@ -117,9 +117,9 @@ public:
lldb_private::CompilerDeclContext FindNamespace(
lldb_private::ConstString name,
const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
- size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- lldb_private::TypeList &type_list) override;
+ void GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ lldb_private::TypeList &type_list) override;
std::vector<lldb_private::CallEdge>
ParseCallEdgesInFunction(lldb_private::UserID func_id) override;
Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Tue Oct 1 08:40:41 2019
@@ -1250,33 +1250,28 @@ uint32_t SymbolFileNativePDB::FindFuncti
return 0;
}
-uint32_t SymbolFileNativePDB::FindTypes(
+void SymbolFileNativePDB::FindTypes(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
- uint32_t max_matches,
- llvm::DenseSet<SymbolFile *> &searched_symbol_files, TypeMap &types) {
+ uint32_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeMap &types) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
if (!name)
- return 0;
+ return;
searched_symbol_files.clear();
searched_symbol_files.insert(this);
// There is an assumption 'name' is not a regex
- size_t match_count = FindTypesByName(name.GetStringRef(), max_matches, types);
-
- return match_count;
+ FindTypesByName(name.GetStringRef(), max_matches, types);
}
-size_t SymbolFileNativePDB::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, TypeMap &types) {
- return 0;
-}
+void SymbolFileNativePDB::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
+ LanguageSet languages, TypeMap &types) {}
-size_t SymbolFileNativePDB::FindTypesByName(llvm::StringRef name,
- uint32_t max_matches,
- TypeMap &types) {
+void SymbolFileNativePDB::FindTypesByName(llvm::StringRef name,
+ uint32_t max_matches,
+ TypeMap &types) {
- size_t match_count = 0;
std::vector<TypeIndex> matches = m_index->tpi().findRecordsByName(name);
if (max_matches > 0 && max_matches < matches.size())
matches.resize(max_matches);
@@ -1287,9 +1282,7 @@ size_t SymbolFileNativePDB::FindTypesByN
continue;
types.Insert(type);
- ++match_count;
}
- return match_count;
}
size_t SymbolFileNativePDB::ParseTypes(CompileUnit &comp_unit) {
@@ -1578,11 +1571,9 @@ bool SymbolFileNativePDB::CompleteType(C
return m_ast->CompleteType(qt);
}
-size_t SymbolFileNativePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope,
- TypeClass type_mask,
- lldb_private::TypeList &type_list) {
- return 0;
-}
+void SymbolFileNativePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ TypeClass type_mask,
+ lldb_private::TypeList &type_list) {}
CompilerDeclContext
SymbolFileNativePDB::FindNamespace(ConstString name,
Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h Tue Oct 1 08:40:41 2019
@@ -116,8 +116,8 @@ public:
lldb::SymbolContextItem resolve_scope,
SymbolContextList &sc_list) override;
- size_t GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask,
- TypeList &type_list) override;
+ void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask,
+ TypeList &type_list) override;
uint32_t FindFunctions(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
@@ -128,14 +128,13 @@ public:
uint32_t FindFunctions(const RegularExpression ®ex, bool include_inlines,
bool append, SymbolContextList &sc_list) override;
- uint32_t FindTypes(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- uint32_t max_matches,
- llvm::DenseSet<SymbolFile *> &searched_symbol_files,
- TypeMap &types) override;
+ void FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
+ uint32_t max_matches,
+ llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeMap &types) override;
- size_t FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, TypeMap &types) override;
+ void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
+ TypeMap &types) override;
llvm::Expected<TypeSystem &>
GetTypeSystemForLanguage(lldb::LanguageType language) override;
@@ -158,8 +157,8 @@ private:
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
- size_t FindTypesByName(llvm::StringRef name, uint32_t max_matches,
- TypeMap &types);
+ void FindTypesByName(llvm::StringRef name, uint32_t max_matches,
+ TypeMap &types);
lldb::TypeSP CreateModifierType(PdbTypeSymId type_id,
const llvm::codeview::ModifierRecord &mr,
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Tue Oct 1 08:40:41 2019
@@ -47,11 +47,9 @@ SymbolFile *SymbolFileSymtab::CreateInst
return new SymbolFileSymtab(std::move(objfile_sp));
}
-size_t SymbolFileSymtab::GetTypes(SymbolContextScope *sc_scope,
- TypeClass type_mask,
- lldb_private::TypeList &type_list) {
- return 0;
-}
+void SymbolFileSymtab::GetTypes(SymbolContextScope *sc_scope,
+ TypeClass type_mask,
+ lldb_private::TypeList &type_list) {}
SymbolFileSymtab::SymbolFileSymtab(ObjectFileSP objfile_sp)
: SymbolFile(std::move(objfile_sp)), m_source_indexes(), m_func_indexes(),
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h Tue Oct 1 08:40:41 2019
@@ -71,9 +71,9 @@ public:
lldb::SymbolContextItem resolve_scope,
lldb_private::SymbolContext &sc) override;
- size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- lldb_private::TypeList &type_list) override;
+ void GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ lldb_private::TypeList &type_list) override;
// PluginInterface protocol
lldb_private::ConstString GetPluginName() override;
Modified: lldb/trunk/source/Symbol/SymbolFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolFile.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolFile.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolFile.cpp Tue Oct 1 08:40:41 2019
@@ -139,18 +139,14 @@ void SymbolFile::GetMangledNamesForFunct
return;
}
-uint32_t SymbolFile::FindTypes(
+void SymbolFile::FindTypes(
ConstString name, const CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
- TypeMap &types) {
- return 0;
-}
+ TypeMap &types) {}
-size_t SymbolFile::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
- LanguageSet languages, TypeMap &types) {
- return 0;
-}
+void SymbolFile::FindTypes(llvm::ArrayRef<CompilerContext> pattern,
+ LanguageSet languages, TypeMap &types) {}
void SymbolFile::AssertModuleLock() {
// The code below is too expensive to leave enabled in release builds. It's
Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=373344&r1=373343&r2=373344&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Tue Oct 1 08:40:41 2019
@@ -355,8 +355,7 @@ TEST_F(SymbolFilePDBTests, TestSimpleCla
llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
llvm::DenseSet<SymbolFile *> searched_files;
TypeMap results;
- symfile->FindTypes(ConstString("Class"), nullptr, false, 0, searched_files,
- results);
+ symfile->FindTypes(ConstString("Class"), nullptr, 0, searched_files, results);
EXPECT_EQ(1u, results.GetSize());
lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
EXPECT_EQ(ConstString("Class"), udt_type->GetName());
@@ -385,8 +384,7 @@ TEST_F(SymbolFilePDBTests, TestNestedCla
llvm::dyn_cast_or_null<ClangASTContext>(&clang_ast_ctx_or_err.get());
EXPECT_NE(nullptr, clang_ast_ctx);
- symfile->FindTypes(ConstString("Class"), nullptr, false, 0, searched_files,
- results);
+ symfile->FindTypes(ConstString("Class"), nullptr, 0, searched_files, results);
EXPECT_EQ(1u, results.GetSize());
auto Class = results.GetTypeAtIndex(0);
@@ -404,8 +402,8 @@ TEST_F(SymbolFilePDBTests, TestNestedCla
// 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);
- symfile->FindTypes(ConstString("NestedClass"), &ClassCompilerDeclCtx, false,
- 0, searched_files, results);
+ symfile->FindTypes(ConstString("NestedClass"), &ClassCompilerDeclCtx, 0,
+ searched_files, results);
EXPECT_LE(1u, results.GetSize());
lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
@@ -449,8 +447,8 @@ TEST_F(SymbolFilePDBTests, TestClassInNa
auto ns_namespace = symfile->FindNamespace(ConstString("NS"), nullptr);
EXPECT_TRUE(ns_namespace.IsValid());
- symfile->FindTypes(ConstString("NSClass"), &ns_namespace, false,
- 0, searched_files, results);
+ symfile->FindTypes(ConstString("NSClass"), &ns_namespace, 0, searched_files,
+ results);
EXPECT_EQ(1u, results.GetSize());
lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
@@ -475,8 +473,7 @@ TEST_F(SymbolFilePDBTests, TestEnumTypes
const char *EnumsToCheck[] = {"Enum", "ShortEnum"};
for (auto Enum : EnumsToCheck) {
TypeMap results;
- symfile->FindTypes(ConstString(Enum), nullptr, false, 0,
- searched_files, results);
+ symfile->FindTypes(ConstString(Enum), nullptr, 0, searched_files, results);
EXPECT_EQ(1u, results.GetSize());
lldb::TypeSP enum_type = results.GetTypeAtIndex(0);
EXPECT_EQ(ConstString(Enum), enum_type->GetName());
@@ -524,8 +521,8 @@ TEST_F(SymbolFilePDBTests, TestTypedefs)
"VariadicFuncPointerTypedef"};
for (auto Typedef : TypedefsToCheck) {
TypeMap results;
- symfile->FindTypes(ConstString(Typedef), nullptr, false, 0,
- searched_files, results);
+ symfile->FindTypes(ConstString(Typedef), nullptr, 0, searched_files,
+ results);
EXPECT_EQ(1u, results.GetSize());
lldb::TypeSP typedef_type = results.GetTypeAtIndex(0);
EXPECT_EQ(ConstString(Typedef), typedef_type->GetName());
@@ -570,7 +567,7 @@ TEST_F(SymbolFilePDBTests, TestMaxMatche
llvm::DenseSet<SymbolFile *> searched_files;
TypeMap results;
const ConstString name("ClassTypedef");
- symfile->FindTypes(name, nullptr, false, 0, searched_files, results);
+ symfile->FindTypes(name, nullptr, 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
@@ -579,7 +576,7 @@ TEST_F(SymbolFilePDBTests, TestMaxMatche
uint32_t iterations = std::min(results.GetSize(), 10u);
uint32_t num_results = results.GetSize();
for (uint32_t i = 1; i <= iterations; ++i) {
- symfile->FindTypes(name, nullptr, false, i, searched_files, results);
+ symfile->FindTypes(name, nullptr, i, searched_files, results);
uint32_t num_limited_results = results.GetSize() - num_results);
EXPECT_EQ(i, num_limited_results);
EXPECT_EQ(num_limited_results, results.GetSize());
@@ -595,7 +592,7 @@ TEST_F(SymbolFilePDBTests, TestNullName)
static_cast<SymbolFilePDB *>(module->GetSymbolFile());
llvm::DenseSet<SymbolFile *> searched_files;
TypeMap results;
- symfile->FindTypes(ConstString(), nullptr, false, 0, searched_files, results);
+ symfile->FindTypes(ConstString(), nullptr, 0, searched_files, results);
EXPECT_EQ(0u, results.GetSize());
}
More information about the lldb-commits
mailing list