From 28f11b43d6fcf446c9f767580e676d2029386cce Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 14 Jan 2019 22:41:21 +0000 Subject: [SymbolFile] Remove SymbolContext parameter from FindTypes. This parameter was only ever used with the Module set, and since a SymbolFile is tied to a module, the parameter turns out to be entirely unnecessary. Furthermore, it doesn't make a lot of sense to ask a caller to ask SymbolFile which is tied to Module X to find types for Module Y, but that possibility was open with the previous interface. By removing this parameter from the API, it makes it harder to use incorrectly as well as easier for an implementor to understand what it needs to do. --- .../SymbolFile/PDB/SymbolFilePDBTests.cpp | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'lldb/unittests') diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp index 15c55611cf5..33b520e792e 100644 --- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp +++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp @@ -366,10 +366,9 @@ TEST_F(SymbolFilePDBTests, TestSimpleClassTypes) { SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class"), nullptr, false, 0, + EXPECT_EQ(1u, symfile->FindTypes(ConstString("Class"), nullptr, false, 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP udt_type = results.GetTypeAtIndex(0); @@ -389,7 +388,6 @@ TEST_F(SymbolFilePDBTests, TestNestedClassTypes) { SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; @@ -397,7 +395,7 @@ TEST_F(SymbolFilePDBTests, TestNestedClassTypes) { symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus)); EXPECT_NE(nullptr, clang_ast_ctx); - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString("Class"), nullptr, false, 0, + EXPECT_EQ(1u, symfile->FindTypes(ConstString("Class"), nullptr, false, 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); @@ -416,7 +414,7 @@ TEST_F(SymbolFilePDBTests, TestNestedClassTypes) { // 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); - EXPECT_LE(1u, symfile->FindTypes(sc, ConstString("NestedClass"), + EXPECT_LE(1u, symfile->FindTypes(ConstString("NestedClass"), &ClassCompilerDeclCtx, false, 0, searched_files, results)); EXPECT_LE(1u, results.GetSize()); @@ -459,9 +457,8 @@ TEST_F(SymbolFilePDBTests, TestClassInNamespace) { 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, symfile->FindTypes(ConstString("NSClass"), &ns_namespace, false, + 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP udt_type = results.GetTypeAtIndex(0); @@ -483,12 +480,11 @@ TEST_F(SymbolFilePDBTests, TestEnumTypes) { SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; const char *EnumsToCheck[] = {"Enum", "ShortEnum"}; for (auto Enum : EnumsToCheck) { TypeMap results; - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Enum), nullptr, false, 0, + EXPECT_EQ(1u, symfile->FindTypes(ConstString(Enum), nullptr, false, 0, searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP enum_type = results.GetTypeAtIndex(0); @@ -530,7 +526,6 @@ TEST_F(SymbolFilePDBTests, TestTypedefs) { SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); llvm::pdb::IPDBSession &session = symfile->GetPDBSession(); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; @@ -539,8 +534,8 @@ TEST_F(SymbolFilePDBTests, TestTypedefs) { "VariadicFuncPointerTypedef"}; for (auto Typedef : TypedefsToCheck) { TypeMap results; - EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Typedef), nullptr, false, - 0, searched_files, results)); + EXPECT_EQ(1u, symfile->FindTypes(ConstString(Typedef), nullptr, false, 0, + searched_files, results)); EXPECT_EQ(1u, results.GetSize()); lldb::TypeSP typedef_type = results.GetTypeAtIndex(0); EXPECT_EQ(ConstString(Typedef), typedef_type->GetName()); @@ -584,12 +579,11 @@ TEST_F(SymbolFilePDBTests, TestMaxMatches) { SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; const ConstString name("ClassTypedef"); uint32_t num_results = - symfile->FindTypes(sc, name, nullptr, false, 0, searched_files, results); + symfile->FindTypes(name, nullptr, false, 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 @@ -597,8 +591,8 @@ TEST_F(SymbolFilePDBTests, TestMaxMatches) { // comes out to the number we are expecting. uint32_t iterations = std::min(num_results, 10u); for (uint32_t i = 1; i <= iterations; ++i) { - uint32_t num_limited_results = symfile->FindTypes( - sc, name, nullptr, false, i, searched_files, results); + uint32_t num_limited_results = + symfile->FindTypes(name, nullptr, false, i, searched_files, results); EXPECT_EQ(i, num_limited_results); EXPECT_EQ(num_limited_results, results.GetSize()); } @@ -612,11 +606,10 @@ TEST_F(SymbolFilePDBTests, TestNullName) { SymbolVendor *plugin = module->GetSymbolVendor(); SymbolFilePDB *symfile = static_cast(plugin->GetSymbolFile()); - SymbolContext sc; llvm::DenseSet searched_files; TypeMap results; - uint32_t num_results = symfile->FindTypes(sc, ConstString(), nullptr, false, - 0, searched_files, results); + uint32_t num_results = symfile->FindTypes(ConstString(), nullptr, false, 0, + searched_files, results); EXPECT_EQ(0u, num_results); EXPECT_EQ(0u, results.GetSize()); } -- cgit v1.2.3