[InstCombine] Signed saturation patterns
[llvm-complete.git] / lib / DebugInfo / DWARF / DWARFTypeUnit.cpp
blobbb81090ba25cf091b3410b0d79e5cc92f4ef6a38
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 //===----------------------------------------------------------------------===//
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>
18 using namespace llvm;
20 void DWARFTypeUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
21 DWARFDie TD = getDIEForOffset(getTypeOffset() + getOffset());
22 const char *Name = TD.getName(DINameKind::ShortName);
24 if (DumpOpts.SummarizeTypes) {
25 OS << "name = '" << Name << "'"
26 << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
27 << " length = " << format("0x%08" PRIx64, getLength()) << '\n';
28 return;
31 OS << format("0x%08" PRIx64, getOffset()) << ": Type Unit:"
32 << " length = " << format("0x%08" PRIx64, getLength())
33 << " version = " << format("0x%04x", getVersion());
34 if (getVersion() >= 5)
35 OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
36 OS << " abbr_offset = "
37 << format("0x%04" PRIx64, getAbbreviations()->getOffset())
38 << " addr_size = " << format("0x%02x", getAddressByteSize())
39 << " name = '" << Name << "'"
40 << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
41 << " type_offset = " << format("0x%04" PRIx64, getTypeOffset())
42 << " (next unit at " << format("0x%08" PRIx64, getNextUnitOffset())
43 << ")\n";
45 if (DWARFDie TU = getUnitDIE(false))
46 TU.dump(OS, 0, DumpOpts);
47 else
48 OS << "<type unit can't be parsed!>\n\n";