1 //===-- YAMLModuleTester.cpp ----------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
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"
15 using namespace lldb_private
;
16 using namespace lldb_private::plugin::dwarf
;
18 YAMLModuleTester::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
);
23 m_module_sp
= std::make_shared
<Module
>(m_file
->moduleSpec());
24 auto &symfile
= *llvm::cast
<SymbolFileDWARF
>(m_module_sp
->GetSymbolFile());
26 m_dwarf_unit
= symfile
.DebugInfo().GetUnitAtIndex(cu_index
);