blob: 113ee04bab952a89681e30cd7725b93c297d9b52 [file] [log] [blame]
Eugene Zelenko570e39a2016-11-23 23:16:32 +00001//===- IPDBSourceFile.cpp - base interface for a PDB source file ----------===//
Zachary Turnera5549172015-02-10 22:43:25 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Zachary Turnera5549172015-02-10 22:43:25 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
Zachary Turnera5549172015-02-10 22:43:25 +000010#include "llvm/DebugInfo/PDB/PDBExtras.h"
Eugene Zelenko570e39a2016-11-23 23:16:32 +000011#include "llvm/DebugInfo/PDB/PDBTypes.h"
Zachary Turnera5549172015-02-10 22:43:25 +000012#include "llvm/Support/Format.h"
13#include "llvm/Support/raw_ostream.h"
Eugene Zelenko570e39a2016-11-23 23:16:32 +000014#include <cstdint>
15#include <string>
Zachary Turnera5549172015-02-10 22:43:25 +000016
17using namespace llvm;
Zachary Turnerec28fc32016-05-04 20:32:13 +000018using namespace llvm::pdb;
Zachary Turnera5549172015-02-10 22:43:25 +000019
Eugene Zelenko570e39a2016-11-23 23:16:32 +000020IPDBSourceFile::~IPDBSourceFile() = default;
Zachary Turnera5549172015-02-10 22:43:25 +000021
Zachary Turnerbc42da02015-02-23 05:59:14 +000022void IPDBSourceFile::dump(raw_ostream &OS, int Indent) const {
23 OS.indent(Indent);
24 PDB_Checksum ChecksumType = getChecksumType();
25 OS << "[";
26 if (ChecksumType != PDB_Checksum::None) {
27 OS << ChecksumType << ": ";
28 std::string Checksum = getChecksum();
29 for (uint8_t c : Checksum)
30 OS << format_hex_no_prefix(c, 2, true);
31 } else
32 OS << "No checksum";
33 OS << "] " << getFileName() << "\n";
Zachary Turnera5549172015-02-10 22:43:25 +000034}