1 //===-- YAMLModuleTester.cpp ----------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "TestingSupport/Symbol/YAMLModuleTester.h" 10 #include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h" 11 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" 12 #include "lldb/Core/Section.h" 13 #include "llvm/ObjectYAML/DWARFEmitter.h" 14 15 using namespace lldb_private; 16 using namespace lldb_private::plugin::dwarf; 17 YAMLModuleTester(llvm::StringRef yaml_data,size_t cu_index)18YAMLModuleTester::YAMLModuleTester(llvm::StringRef yaml_data, size_t cu_index) { 19 llvm::Expected<TestFile> File = TestFile::fromYaml(yaml_data); 20 EXPECT_THAT_EXPECTED(File, llvm::Succeeded()); 21 m_file = std::move(*File); 22 23 m_module_sp = std::make_shared<Module>(m_file->moduleSpec()); 24 auto &symfile = *llvm::cast<SymbolFileDWARF>(m_module_sp->GetSymbolFile()); 25 26 m_dwarf_unit = symfile.DebugInfo().GetUnitAtIndex(cu_index); 27 } 28