diff options
author | Zachary Turner <zturner@google.com> | 2019-01-14 22:41:00 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2019-01-14 22:41:00 +0000 |
commit | cad37b29fa8a8b23965b3e669d0e9760fe99c794 (patch) | |
tree | 9aff315a6938739dd2b3f88d203c6f67a52862e9 /lldb | |
parent | 48457b85d1b59afd913990e0e737138194ecc11b (diff) |
[SymbolFile] Remove the SymbolContext parameter from FindNamespace.
Every callsite was passing an empty SymbolContext, so this parameter
had no effect. Inside the DWARF implementation of this function,
however, there was one codepath that checked members of the
SymbolContext. Since no call-sites actually ever used this
functionality, it was essentially dead code, so I've deleted this
code path as well.
Diffstat (limited to 'lldb')
15 files changed, 20 insertions, 43 deletions
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 9967815b02a..4fd549b57b0 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -218,7 +218,7 @@ public: GetTypeSystemForLanguage(lldb::LanguageType language); virtual CompilerDeclContext - FindNamespace(const SymbolContext &sc, const ConstString &name, + FindNamespace(const ConstString &name, const CompilerDeclContext *parent_decl_ctx) { return CompilerDeclContext(); } diff --git a/lldb/include/lldb/Symbol/SymbolVendor.h b/lldb/include/lldb/Symbol/SymbolVendor.h index b0329265498..67375d36497 100644 --- a/lldb/include/lldb/Symbol/SymbolVendor.h +++ b/lldb/include/lldb/Symbol/SymbolVendor.h @@ -109,7 +109,7 @@ public: bool append, TypeMap &types); virtual CompilerDeclContext - FindNamespace(const SymbolContext &sc, const ConstString &name, + FindNamespace(const ConstString &name, const CompilerDeclContext *parent_decl_ctx); virtual size_t GetNumCompileUnits(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 59d7fe01c24..087798bea9a 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -802,10 +802,8 @@ void ClangASTSource::FindExternalVisibleDecls( SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(); if (symbol_vendor) { - SymbolContext null_sc; - found_namespace_decl = - symbol_vendor->FindNamespace(null_sc, name, &namespace_decl); + symbol_vendor->FindNamespace(name, &namespace_decl); if (found_namespace_decl) { context.m_namespace_map->push_back( @@ -835,10 +833,8 @@ void ClangASTSource::FindExternalVisibleDecls( if (!symbol_vendor) continue; - SymbolContext null_sc; - found_namespace_decl = - symbol_vendor->FindNamespace(null_sc, name, &namespace_decl); + symbol_vendor->FindNamespace(name, &namespace_decl); if (found_namespace_decl) { context.m_namespace_map->push_back( @@ -1881,10 +1877,8 @@ void ClangASTSource::CompleteNamespaceMap( if (!symbol_vendor) continue; - SymbolContext null_sc; - - found_namespace_decl = symbol_vendor->FindNamespace( - null_sc, name, &module_parent_namespace_decl); + found_namespace_decl = + symbol_vendor->FindNamespace(name, &module_parent_namespace_decl); if (!found_namespace_decl) continue; @@ -1916,10 +1910,8 @@ void ClangASTSource::CompleteNamespaceMap( if (!symbol_vendor) continue; - SymbolContext null_sc; - found_namespace_decl = - symbol_vendor->FindNamespace(null_sc, name, &null_namespace_decl); + symbol_vendor->FindNamespace(name, &null_namespace_decl); if (!found_namespace_decl) continue; diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h index e32479594c4..1a71f22a39f 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h @@ -127,7 +127,7 @@ public: } CompilerDeclContext - FindNamespace(const SymbolContext &sc, const ConstString &name, + FindNamespace(const ConstString &name, const CompilerDeclContext *parent_decl_ctx) override { return CompilerDeclContext(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index a765724d623..b39ab888290 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2587,7 +2587,7 @@ size_t SymbolFileDWARF::FindTypes(const std::vector<CompilerContext> &context, } CompilerDeclContext -SymbolFileDWARF::FindNamespace(const SymbolContext &sc, const ConstString &name, +SymbolFileDWARF::FindNamespace(const ConstString &name, const CompilerDeclContext *parent_decl_ctx) { Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 4791c49c8fd..664cda046f1 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -213,7 +213,6 @@ public: GetTypeSystemForLanguage(lldb::LanguageType language) override; lldb_private::CompilerDeclContext FindNamespace( - const lldb_private::SymbolContext &sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx) override; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 48677102a49..2e9b6c012eb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -1221,23 +1221,15 @@ uint32_t SymbolFileDWARFDebugMap::FindTypes( //} CompilerDeclContext SymbolFileDWARFDebugMap::FindNamespace( - const lldb_private::SymbolContext &sc, const lldb_private::ConstString &name, const CompilerDeclContext *parent_decl_ctx) { CompilerDeclContext matching_namespace; - SymbolFileDWARF *oso_dwarf; - if (sc.comp_unit) { - oso_dwarf = GetSymbolFile(sc); - if (oso_dwarf) - matching_namespace = oso_dwarf->FindNamespace(sc, name, parent_decl_ctx); - } else { - ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { - matching_namespace = oso_dwarf->FindNamespace(sc, name, parent_decl_ctx); + ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { + matching_namespace = oso_dwarf->FindNamespace(name, parent_decl_ctx); - return (bool)matching_namespace; - }); - } + return (bool)matching_namespace; + }); return matching_namespace; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h index 31c0dbc51ef..04cc70d02b7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -123,7 +123,6 @@ public: llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, lldb_private::TypeMap &types) override; lldb_private::CompilerDeclContext FindNamespace( - const lldb_private::SymbolContext &sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx) override; size_t GetTypes(lldb_private::SymbolContextScope *sc_scope, diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp index 698de0e1f54..fa839d57a35 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -1550,8 +1550,7 @@ size_t SymbolFileNativePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope, } CompilerDeclContext -SymbolFileNativePDB::FindNamespace(const SymbolContext &sc, - const ConstString &name, +SymbolFileNativePDB::FindNamespace(const ConstString &name, const CompilerDeclContext *parent_decl_ctx) { return {}; } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h index bb95056ffde..6c3410ec498 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h @@ -151,7 +151,7 @@ public: TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language) override; CompilerDeclContext - FindNamespace(const SymbolContext &sc, const ConstString &name, + FindNamespace(const ConstString &name, const CompilerDeclContext *parent_decl_ctx) override; ConstString GetPluginName() override; diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp index 72766a1e553..c5658d5bb5b 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -1619,7 +1619,6 @@ PDBASTParser *SymbolFilePDB::GetPDBAstParser() { lldb_private::CompilerDeclContext SymbolFilePDB::FindNamespace( - const lldb_private::SymbolContext &sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx) { auto type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h index 68c4ed7408c..0eb48620f06 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h @@ -160,7 +160,6 @@ public: GetTypeSystemForLanguage(lldb::LanguageType language) override; lldb_private::CompilerDeclContext FindNamespace( - const lldb_private::SymbolContext &sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx) override; diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index fda2f23e656..26420f09f3e 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -352,15 +352,14 @@ size_t SymbolVendor::GetTypes(SymbolContextScope *sc_scope, TypeClass type_mask, } CompilerDeclContext -SymbolVendor::FindNamespace(const SymbolContext &sc, const ConstString &name, +SymbolVendor::FindNamespace(const ConstString &name, const CompilerDeclContext *parent_decl_ctx) { CompilerDeclContext namespace_decl_ctx; ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); if (m_sym_file_ap.get()) - namespace_decl_ctx = - m_sym_file_ap->FindNamespace(sc, name, parent_decl_ctx); + namespace_decl_ctx = m_sym_file_ap->FindNamespace(name, parent_decl_ctx); } return namespace_decl_ctx; } diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp index 29dd7cb99cf..92c178098a1 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -441,9 +441,8 @@ Error opts::symbols::findNamespaces(lldb_private::Module &Module) { CompilerDeclContext *ContextPtr = ContextOr->IsValid() ? &*ContextOr : nullptr; - SymbolContext SC; CompilerDeclContext Result = - Vendor.FindNamespace(SC, ConstString(Name), ContextPtr); + Vendor.FindNamespace(ConstString(Name), ContextPtr); if (Result) outs() << "Found namespace: " << Result.GetScopeQualifiedName().GetStringRef() << "\n"; diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp index 32c7002a15c..15c55611cf5 100644 --- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp +++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp @@ -440,7 +440,6 @@ TEST_F(SymbolFilePDBTests, TestClassInNamespace) { SymbolFilePDB *symfile = static_cast<SymbolFilePDB *>(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet<SymbolFile *> searched_files; TypeMap results; @@ -457,9 +456,10 @@ TEST_F(SymbolFilePDBTests, TestClassInNamespace) { symfile->ParseDeclsForContext(CompilerDeclContext( clang_ast_ctx, static_cast<clang::DeclContext *>(tu))); - auto ns_namespace = symfile->FindNamespace(sc, ConstString("NS"), nullptr); + 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, results.GetSize()); |