Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- DWARFTypeUnit.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 "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
10
#include "llvm/DebugInfo/DIContext.h"
11
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
12
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
13
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
14
#include "llvm/Support/Format.h"
15
#include "llvm/Support/raw_ostream.h"
16
#include <cinttypes>
17
18
using namespace llvm;
19
20
60
void DWARFTypeUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
21
60
  DWARFDie TD = getDIEForOffset(getTypeOffset() + getOffset());
22
60
  const char *Name = TD.getName(DINameKind::ShortName);
23
60
24
60
  if (DumpOpts.SummarizeTypes) {
25
2
    OS << "name = '" << Name << "'"
26
2
       << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
27
2
       << " length = " << format("0x%08x", getLength()) << '\n';
28
2
    return;
29
2
  }
30
58
31
58
  OS << format("0x%08x", getOffset()) << ": Type Unit:"
32
58
     << " length = " << format("0x%08x", getLength())
33
58
     << " version = " << format("0x%04x", getVersion());
34
58
  if (getVersion() >= 5)
35
15
    OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
36
58
  OS << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
37
58
     << " addr_size = " << format("0x%02x", getAddressByteSize())
38
58
     << " name = '" << Name << "'"
39
58
     << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
40
58
     << " type_offset = " << format("0x%04x", getTypeOffset())
41
58
     << " (next unit at " << format("0x%08x", getNextUnitOffset()) << ")\n";
42
58
43
58
  if (DWARFDie TU = getUnitDIE(false))
44
58
    TU.dump(OS, 0, DumpOpts);
45
0
  else
46
0
    OS << "<type unit can't be parsed!>\n\n";
47
58
}