1 //===- NativeSourceFile.cpp - Native line number implementaiton -*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/PDB/Native/NativeSourceFile.h"
10 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
13 using namespace llvm::pdb;
15 NativeSourceFile::NativeSourceFile(NativeSession &Session, uint32_t FileId,
16 const codeview::FileChecksumEntry &Checksum)
17 : Session(Session), FileId(FileId), Checksum(Checksum) {}
19 std::string NativeSourceFile::getFileName() const {
20 auto ST = Session.getPDBFile().getStringTable();
22 consumeError(ST.takeError());
25 auto FileName = ST->getStringTable().getString(Checksum.FileNameOffset);
27 consumeError(FileName.takeError());
31 return std::string(FileName.get());
34 uint32_t NativeSourceFile::getUniqueId() const { return FileId; }
36 std::string NativeSourceFile::getChecksum() const {
37 return toStringRef(Checksum.Checksum).str();
40 PDB_Checksum NativeSourceFile::getChecksumType() const {
41 return static_cast<PDB_Checksum>(Checksum.Kind);
44 std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
45 NativeSourceFile::getCompilands() const {