@@ -721,7 +721,7 @@ TEST_F(SymtabTest, TestDecodeCStringMaps) {
721721  ASSERT_NE (symbol, nullptr );
722722}
723723
724- TEST_F (SymtabTest, TestSymbolFileCreatedOnDemand ) {
724+ TEST_F (SymtabTest, TestSymtabCreatedOnDemand ) {
725725  auto  ExpectedFile = TestFile::fromYaml (R"( 
726726--- !ELF 
727727FileHeader: 
@@ -749,7 +749,7 @@ TEST_F(SymtabTest, TestSymbolFileCreatedOnDemand) {
749749  ASSERT_THAT_EXPECTED (ExpectedFile, llvm::Succeeded ());
750750  auto  module_sp = std::make_shared<Module>(ExpectedFile->moduleSpec ());
751751
752-   //  The symbol file  should not be created  by default.
752+   //  The symbol table  should not be loaded  by default.
753753  Symtab *module_symtab = module_sp->GetSymtab (/* can_create=*/ false );
754754  ASSERT_EQ (module_symtab, nullptr );
755755
@@ -761,77 +761,3 @@ TEST_F(SymtabTest, TestSymbolFileCreatedOnDemand) {
761761  Symtab *cached_module_symtab = module_sp->GetSymtab (/* can_create=*/ false );
762762  ASSERT_EQ (module_symtab, cached_module_symtab);
763763}
764- 
765- TEST_F (SymtabTest, TestSymbolTableCreatedOnDemand) {
766-   const  char  *yamldata = R"( 
767- --- !ELF 
768- FileHeader: 
769-   Class:   ELFCLASS64 
770-   Data:    ELFDATA2LSB 
771-   Type:    ET_EXEC 
772-   Machine: EM_386 
773- DWARF: 
774-   debug_abbrev: 
775-     - Table: 
776-         - Code:            0x00000001 
777-           Tag:             DW_TAG_compile_unit 
778-           Children:        DW_CHILDREN_no 
779-           Attributes: 
780-             - Attribute:       DW_AT_addr_base 
781-               Form:            DW_FORM_sec_offset 
782-   debug_info: 
783-     - Version:         5 
784-       AddrSize:        4 
785-       UnitType:        DW_UT_compile 
786-       Entries: 
787-         - AbbrCode:        0x00000001 
788-           Values: 
789-             - Value:           0x8 # Offset of the first Address past the header 
790-         - AbbrCode:        0x0 
791-   debug_addr: 
792-     - Version: 5 
793-       AddressSize: 4 
794-       Entries: 
795-         - Address: 0x1234 
796-         - Address: 0x5678 
797-   debug_line: 
798-     - Length:          42 
799-       Version:         2 
800-       PrologueLength:  36 
801-       MinInstLength:   1 
802-       DefaultIsStmt:   1 
803-       LineBase:        251 
804-       LineRange:       14 
805-       OpcodeBase:      13 
806-       StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] 
807-       IncludeDirs: 
808-         - '/tmp' 
809-       Files: 
810-         - Name:            main.cpp 
811-           DirIdx:          1 
812-           ModTime:         0 
813-           Length:          0 
814- )" 
815-   llvm::Expected<TestFile> file = TestFile::fromYaml (yamldata);
816-   EXPECT_THAT_EXPECTED (file, llvm::Succeeded ());
817-   auto  module_sp = std::make_shared<Module>(file->moduleSpec ());
818- 
819-   SymbolFile *symbol_file = module_sp->GetSymbolFile ();
820-   //  At this point, the symbol table is not created. This is because the above
821-   //  yaml data contains the necessary sections in order for
822-   //  SymbolFileDWARF::CalculateAbilities() to identify all abilities, saving it
823-   //  from calling SymbolFileDWARFDebugMap::CalculateAbilities(), which
824-   //  eventually loads the symbol table, which we don't want.
825- 
826-   //  The symbol table should not be created if asked not to.
827-   Symtab *symtab = symbol_file->GetSymtab (/* can_create=*/ false );
828-   ASSERT_EQ (symtab, nullptr );
829- 
830-   //  But it should be created on demand.
831-   symtab = symbol_file->GetSymtab (/* can_create=*/ true );
832-   ASSERT_NE (symtab, nullptr );
833- 
834-   //  And we should be able to get it again once it has been created.
835-   Symtab *cached_symtab = symbol_file->GetSymtab (/* can_create=*/ false );
836-   ASSERT_EQ (symtab, cached_symtab);
837- }
0 commit comments