Author: Med Ismail Bennani Date: 2021-05-05T00:34:44Z New Revision: 30fcdf0b196600001ca77767bd41ceba03f5dd33
URL: https://github.com/llvm/llvm-project/commit/30fcdf0b196600001ca77767bd41ceba03f5dd33 DIFF: https://github.com/llvm/llvm-project/commit/30fcdf0b196600001ca77767bd41ceba03f5dd33.diff LOG: [lldb/Symbol] Update SymbolFilePDB unitest with SourceLocationSpec This patch should fix the windows test failure following `3e2ed7440569`. It makes use of a `SourceLocationSpec` object when resolving a symbol context from `SymbolFilePDB` file. Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com> Added: Modified: lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp Removed: ################################################################################ diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp index 63bb6b7c40436..f9df3ced747d4 100644 --- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp +++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp @@ -171,8 +171,9 @@ TEST_F(SymbolFilePDBTests, TestResolveSymbolContextBasename) { FileSpec header_spec("test-pdb.cpp"); SymbolContextList sc_list; + SourceLocationSpec location_spec(header_spec, /*line=*/0); uint32_t result_count = symfile->ResolveSymbolContext( - header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list); + location_spec, lldb::eSymbolContextCompUnit, sc_list); EXPECT_EQ(1u, result_count); EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec)); } @@ -190,8 +191,9 @@ TEST_F(SymbolFilePDBTests, TestResolveSymbolContextFullPath) { FileSpec header_spec( R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec"); SymbolContextList sc_list; + SourceLocationSpec location_spec(header_spec, /*line=*/0); uint32_t result_count = symfile->ResolveSymbolContext( - header_spec, 0, false, lldb::eSymbolContextCompUnit, sc_list); + location_spec, lldb::eSymbolContextCompUnit, sc_list); EXPECT_GE(1u, result_count); EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec)); } @@ -214,8 +216,10 @@ TEST_F(SymbolFilePDBTests, TestLookupOfHeaderFileWithInlines) { FileSpec alt_cpp_spec("test-pdb-alt.cpp"); for (const auto &hspec : header_specs) { SymbolContextList sc_list; + SourceLocationSpec location_spec(hspec, /*line=*/0, /*column=*/llvm::None, + /*check_inlines=*/true); uint32_t result_count = symfile->ResolveSymbolContext( - hspec, 0, true, lldb::eSymbolContextCompUnit, sc_list); + location_spec, lldb::eSymbolContextCompUnit, sc_list); EXPECT_EQ(2u, result_count); EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec)); EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec)); @@ -238,8 +242,9 @@ TEST_F(SymbolFilePDBTests, TestLookupOfHeaderFileWithNoInlines) { FileSpec("test-pdb-nested.h")}; for (const auto &hspec : header_specs) { SymbolContextList sc_list; + SourceLocationSpec location_spec(hspec, /*line=*/0); uint32_t result_count = symfile->ResolveSymbolContext( - hspec, 0, false, lldb::eSymbolContextCompUnit, sc_list); + location_spec, lldb::eSymbolContextCompUnit, sc_list); EXPECT_EQ(0u, result_count); } } @@ -264,8 +269,9 @@ TEST_F(SymbolFilePDBTests, TestLineTablesMatchAll) { lldb::SymbolContextItem scope = lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry; - uint32_t count = - symfile->ResolveSymbolContext(source_file, 0, true, scope, sc_list); + SourceLocationSpec location_spec( + source_file, /*line=*/0, /*column=*/llvm::None, /*check_inlines=*/true); + uint32_t count = symfile->ResolveSymbolContext(location_spec, scope, sc_list); EXPECT_EQ(1u, count); SymbolContext sc; EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc)); @@ -314,8 +320,9 @@ TEST_F(SymbolFilePDBTests, TestLineTablesMatchSpecific) { lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry; // First test with line 7, and verify that only line 7 entries are added. - uint32_t count = - symfile->ResolveSymbolContext(source_file, 7, true, scope, sc_list); + SourceLocationSpec location_spec( + source_file, /*line=*/7, /*column=*/llvm::None, /*check_inlines=*/true); + uint32_t count = symfile->ResolveSymbolContext(location_spec, scope, sc_list); EXPECT_EQ(1u, count); SymbolContext sc; EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc)); @@ -331,6 +338,8 @@ TEST_F(SymbolFilePDBTests, TestLineTablesMatchSpecific) { sc_list.Clear(); // Then test with line 9, and verify that only line 9 entries are added. + location_spec = SourceLocationSpec( + source_file, /*line=*/9, /*column=*/llvm::None, /*check_inlines=*/true); count = symfile->ResolveSymbolContext(source_file, 9, true, scope, sc_list); EXPECT_EQ(1u, count); EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc)); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits