• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- NativeSourceFile.cpp - Native line number implementaiton -*- C++ -*-===//
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/PDB/Native/NativeSourceFile.h"
10 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
11 
12 using namespace llvm;
13 using namespace llvm::pdb;
14 
NativeSourceFile(NativeSession & Session,uint32_t FileId,const codeview::FileChecksumEntry & Checksum)15 NativeSourceFile::NativeSourceFile(NativeSession &Session, uint32_t FileId,
16                                    const codeview::FileChecksumEntry &Checksum)
17     : Session(Session), FileId(FileId), Checksum(Checksum) {}
18 
getFileName() const19 std::string NativeSourceFile::getFileName() const {
20   auto ST = Session.getPDBFile().getStringTable();
21   if (!ST) {
22     consumeError(ST.takeError());
23     return "";
24   }
25   auto FileName = ST->getStringTable().getString(Checksum.FileNameOffset);
26   if (!FileName) {
27     consumeError(FileName.takeError());
28     return "";
29   }
30 
31   return std::string(FileName.get());
32 }
33 
getUniqueId() const34 uint32_t NativeSourceFile::getUniqueId() const { return FileId; }
35 
getChecksum() const36 std::string NativeSourceFile::getChecksum() const {
37   return toStringRef(Checksum.Checksum).str();
38 }
39 
getChecksumType() const40 PDB_Checksum NativeSourceFile::getChecksumType() const {
41   return static_cast<PDB_Checksum>(Checksum.Kind);
42 }
43 
44 std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
getCompilands() const45 NativeSourceFile::getCompilands() const {
46   return nullptr;
47 }
48