blob: 9e8699963676bcc254a1457fdd71108170326c73 [file] [log] [blame]
Chris Bieneman7d7364a2016-12-07 22:30:15 +00001//===- yaml2dwarf - Convert YAML to DWARF binary data ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// \brief The DWARF component of yaml2obj.
12///
13//===----------------------------------------------------------------------===//
14
15#include "llvm/ObjectYAML/DWARFYAML.h"
16#include "llvm/Support/Error.h"
17#include "llvm/Support/LEB128.h"
18#include "llvm/Support/raw_ostream.h"
19
20using namespace llvm;
21
22void yaml2debug_str(raw_ostream &OS, const DWARFYAML::DWARFData &DI) {
23 for (auto Str : DI.DebugStrings) {
24 OS.write(Str.data(), Str.size());
25 OS.write('\0');
26 }
27}
28
29void yaml2debug_abbrev(raw_ostream &OS, const DWARFYAML::DWARFData &DI) {
30 for (auto AbbrevDecl : DI.AbbrevDecls) {
31 encodeULEB128(AbbrevDecl.Code, OS);
32 encodeULEB128(AbbrevDecl.Tag, OS);
33 OS.write(AbbrevDecl.Children);
34 for (auto Attr : AbbrevDecl.Attributes) {
35 encodeULEB128(Attr.Attribute, OS);
36 encodeULEB128(Attr.Form, OS);
37 }
38 encodeULEB128(0, OS);
39 encodeULEB128(0, OS);
40 }
41}