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