| 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 |
|
| 17 |
YAMLModuleTester::YAMLModuleTester(llvm::StringRef yaml_data, size_t cu_index) { |
| 18 |
llvm::Expected<TestFile> File = TestFile::fromYaml(yaml_data); |
| 19 |
EXPECT_THAT_EXPECTED(File, llvm::Succeeded()); |
| 20 |
m_file = std::move(*File); |
| 21 |
|
| 22 |
m_module_sp = std::make_shared<Module>(m_file->moduleSpec()); |
| 23 |
auto &symfile = *llvm::cast<SymbolFileDWARF>(m_module_sp->GetSymbolFile()); |
| 24 |
|
| 25 |
m_dwarf_unit = symfile.DebugInfo().GetUnitAtIndex(cu_index); |
| 26 |
} |