1 //===- DbiModuleDescriptor.h - PDB module information -----------*- 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 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULEDESCRIPTOR_H 10 #define LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULEDESCRIPTOR_H 11 12 #include "llvm/ADT/StringRef.h" 13 #include "llvm/Support/BinaryStreamRef.h" 14 #include "llvm/Support/Compiler.h" 15 #include "llvm/Support/Error.h" 16 #include <cstdint> 17 18 namespace llvm { 19 template <typename T> struct VarStreamArrayExtractor; 20 21 namespace pdb { 22 struct ModuleInfoHeader; 23 struct SectionContrib; 24 class DbiModuleDescriptor { 25 friend class DbiStreamBuilder; 26 27 public: 28 DbiModuleDescriptor() = default; 29 DbiModuleDescriptor(const DbiModuleDescriptor &Info) = default; 30 DbiModuleDescriptor &operator=(const DbiModuleDescriptor &Info) = default; 31 32 LLVM_ABI static Error initialize(BinaryStreamRef Stream, 33 DbiModuleDescriptor &Info); 34 35 LLVM_ABI bool hasECInfo() const; 36 LLVM_ABI uint16_t getTypeServerIndex() const; 37 LLVM_ABI uint16_t getModuleStreamIndex() const; 38 LLVM_ABI uint32_t getSymbolDebugInfoByteSize() const; 39 LLVM_ABI uint32_t getC11LineInfoByteSize() const; 40 LLVM_ABI uint32_t getC13LineInfoByteSize() const; 41 LLVM_ABI uint32_t getNumberOfFiles() const; 42 LLVM_ABI uint32_t getSourceFileNameIndex() const; 43 LLVM_ABI uint32_t getPdbFilePathNameIndex() const; 44 45 LLVM_ABI StringRef getModuleName() const; 46 LLVM_ABI StringRef getObjFileName() const; 47 48 LLVM_ABI uint32_t getRecordLength() const; 49 50 LLVM_ABI const SectionContrib &getSectionContrib() const; 51 52 private: 53 StringRef ModuleName; 54 StringRef ObjFileName; 55 const ModuleInfoHeader *Layout = nullptr; 56 }; 57 58 } // end namespace pdb 59 60 template <> struct VarStreamArrayExtractor<pdb::DbiModuleDescriptor> { 61 Error operator()(BinaryStreamRef Stream, uint32_t &Length, 62 pdb::DbiModuleDescriptor &Info) { 63 if (auto EC = pdb::DbiModuleDescriptor::initialize(Stream, Info)) 64 return EC; 65 Length = Info.getRecordLength(); 66 return Error::success(); 67 } 68 }; 69 70 } // end namespace llvm 71 72 #endif // LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULEDESCRIPTOR_H 73