[Lldb-commits] [lldb] r351132 - [SymbolFile] Remove the SymbolContext parameter from FindNamespace.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 14 14:41:01 PST 2019
Author: zturner
Date: Mon Jan 14 14:41:00 2019
New Revision: 351132
URL: http://llvm.org/viewvc/llvm-project?rev=351132&view=rev
Log:
[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.
Modified:
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/SymbolVendor.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
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/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Symbol/SymbolVendor.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Mon Jan 14 14:41:00 2019
@@ -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();
}
Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Mon Jan 14 14:41:00 2019
@@ -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();
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Mon Jan 14 14:41:00 2019
@@ -802,10 +802,8 @@ void ClangASTSource::FindExternalVisible
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::FindExternalVisible
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::CompleteNamespaceMa
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::CompleteNamespaceMa
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;
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=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h Mon Jan 14 14:41:00 2019
@@ -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();
}
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=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Jan 14 14:41:00 2019
@@ -2587,7 +2587,7 @@ size_t SymbolFileDWARF::FindTypes(const
}
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));
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=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Mon Jan 14 14:41:00 2019
@@ -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;
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=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Mon Jan 14 14:41:00 2019
@@ -1221,23 +1221,15 @@ uint32_t SymbolFileDWARFDebugMap::FindTy
//}
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;
}
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=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Mon Jan 14 14:41:00 2019
@@ -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,
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=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Mon Jan 14 14:41:00 2019
@@ -1550,8 +1550,7 @@ size_t SymbolFileNativePDB::GetTypes(lld
}
CompilerDeclContext
-SymbolFileNativePDB::FindNamespace(const SymbolContext &sc,
- const ConstString &name,
+SymbolFileNativePDB::FindNamespace(const ConstString &name,
const CompilerDeclContext *parent_decl_ctx) {
return {};
}
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=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h Mon Jan 14 14:41:00 2019
@@ -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;
Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Mon Jan 14 14:41:00 2019
@@ -1619,7 +1619,6 @@ PDBASTParser *SymbolFilePDB::GetPDBAstPa
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);
Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h Mon Jan 14 14:41:00 2019
@@ -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;
Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Mon Jan 14 14:41:00 2019
@@ -352,15 +352,14 @@ size_t SymbolVendor::GetTypes(SymbolCont
}
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;
}
Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-test/lldb-test.cpp (original)
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp Mon Jan 14 14:41:00 2019
@@ -441,9 +441,8 @@ Error opts::symbols::findNamespaces(lldb
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";
Modified: lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp?rev=351132&r1=351131&r2=351132&view=diff
==============================================================================
--- lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Mon Jan 14 14:41:00 2019
@@ -440,7 +440,6 @@ TEST_F(SymbolFilePDBTests, TestClassInNa
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, TestClassInNa
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());
More information about the lldb-commits
mailing list