Files
clang-p2996/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
Pavel Labath a895a446bc [lldb/test] Simplify/generalize YAMLModuleTester
The class only supports a single DWARF unit (needed for my new test), and it
reimplements chunks of object and symbol file classes. We can just make it use
the real thing, save some LOC and get the full feature set.

Differential Revision: https://reviews.llvm.org/D90393
2020-10-30 14:27:50 +01:00

27 lines
1.0 KiB
C++

//===-- YAMLModuleTester.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "TestingSupport/Symbol/YAMLModuleTester.h"
#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "TestingSupport/TestUtilities.h"
#include "lldb/Core/Section.h"
#include "llvm/ObjectYAML/DWARFEmitter.h"
using namespace lldb_private;
YAMLModuleTester::YAMLModuleTester(llvm::StringRef yaml_data) {
llvm::Expected<TestFile> File = TestFile::fromYaml(yaml_data);
EXPECT_THAT_EXPECTED(File, llvm::Succeeded());
m_module_sp = std::make_shared<Module>(File->moduleSpec());
auto &symfile = *llvm::cast<SymbolFileDWARF>(m_module_sp->GetSymbolFile());
m_dwarf_unit = symfile.DebugInfo().GetUnitAtIndex(0);
}