1 //===- YAMLModuleTester.h ---------------------------------------*- C++ -*-===// 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 #ifndef LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H 10 #define LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H 11 12 #include "Plugins/SymbolFile/DWARF/DWARFUnit.h" 13 #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" 14 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" 15 #include "TestingSupport/SubsystemRAII.h" 16 #include "lldb/Core/Module.h" 17 #include "lldb/Host/HostInfo.h" 18 19 namespace lldb_private { 20 21 /// Helper class that can construct a module from YAML and evaluate 22 /// DWARF expressions on it. 23 class YAMLModuleTester { 24 protected: 25 SubsystemRAII<FileSystem, HostInfo, TypeSystemClang> subsystems; 26 llvm::StringMap<std::unique_ptr<llvm::MemoryBuffer>> m_sections_map; 27 lldb::ModuleSP m_module_sp; 28 lldb::ObjectFileSP m_objfile_sp; 29 DWARFUnitSP m_dwarf_unit; 30 std::unique_ptr<SymbolFileDWARF> m_symfile_dwarf; 31 32 public: 33 /// Parse the debug info sections from the YAML description. 34 YAMLModuleTester(llvm::StringRef yaml_data, llvm::StringRef triple); 35 DWARFUnitSP GetDwarfUnit() const { return m_dwarf_unit; } 36 lldb::ModuleSP GetModule() const { return m_module_sp; } 37 }; 38 39 } // namespace lldb_private 40 41 #endif // LLDB_UNITTESTS_TESTINGSUPPORT_SYMBOL_YAMLMODULETESTER_H 42