xref: /freebsd/contrib/llvm-project/llvm/lib/DebugInfo/PDB/IPDBSourceFile.cpp (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===- IPDBSourceFile.cpp - base interface for a PDB source file ----------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
10*0b57cec5SDimitry Andric #include "llvm/DebugInfo/PDB/PDBExtras.h"
11*0b57cec5SDimitry Andric #include "llvm/DebugInfo/PDB/PDBTypes.h"
12*0b57cec5SDimitry Andric #include "llvm/Support/Format.h"
13*0b57cec5SDimitry Andric #include "llvm/Support/raw_ostream.h"
14*0b57cec5SDimitry Andric #include <cstdint>
15*0b57cec5SDimitry Andric #include <string>
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric using namespace llvm;
18*0b57cec5SDimitry Andric using namespace llvm::pdb;
19*0b57cec5SDimitry Andric 
20*0b57cec5SDimitry Andric IPDBSourceFile::~IPDBSourceFile() = default;
21*0b57cec5SDimitry Andric 
dump(raw_ostream & OS,int Indent) const22*0b57cec5SDimitry Andric void IPDBSourceFile::dump(raw_ostream &OS, int Indent) const {
23*0b57cec5SDimitry Andric   OS.indent(Indent);
24*0b57cec5SDimitry Andric   PDB_Checksum ChecksumType = getChecksumType();
25*0b57cec5SDimitry Andric   OS << "[";
26*0b57cec5SDimitry Andric   if (ChecksumType != PDB_Checksum::None) {
27*0b57cec5SDimitry Andric     OS << ChecksumType << ": ";
28*0b57cec5SDimitry Andric     std::string Checksum = getChecksum();
29*0b57cec5SDimitry Andric     for (uint8_t c : Checksum)
30*0b57cec5SDimitry Andric       OS << format_hex_no_prefix(c, 2, true);
31*0b57cec5SDimitry Andric   } else
32*0b57cec5SDimitry Andric     OS << "No checksum";
33*0b57cec5SDimitry Andric   OS << "] " << getFileName() << "\n";
34*0b57cec5SDimitry Andric }
35