LLVM 22.0.0git
DbiModuleDescriptor.cpp
Go to the documentation of this file.
1//===- DbiModuleDescriptor.cpp - PDB module information -------------------===//
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
12#include "llvm/Support/Error.h"
14#include <cstdint>
15
16using namespace llvm;
17using namespace llvm::pdb;
18using namespace llvm::support;
19
21 DbiModuleDescriptor &Info) {
22 BinaryStreamReader Reader(Stream);
23 if (auto EC = Reader.readObject(Info.Layout))
24 return EC;
25
26 if (auto EC = Reader.readCString(Info.ModuleName))
27 return EC;
28
29 if (auto EC = Reader.readCString(Info.ObjFileName))
30 return EC;
31 return Error::success();
32}
33
35 return (Layout->Flags & ModInfoFlags::HasECFlagMask) != 0;
36}
37
42
44 return Layout->SC;
45}
46
48 return Layout->ModDiStream;
49}
50
52 return Layout->SymBytes;
53}
54
56 return Layout->C11Bytes;
57}
58
60 return Layout->C13Bytes;
61}
62
64 return Layout->NumFiles;
65}
66
68 return Layout->SrcFileNameNI;
69}
70
72 return Layout->PdbFilePathNI;
73}
74
75StringRef DbiModuleDescriptor::getModuleName() const { return ModuleName; }
76
77StringRef DbiModuleDescriptor::getObjFileName() const { return ObjFileName; }
78
80 uint32_t M = ModuleName.str().size() + 1;
81 uint32_t O = ObjFileName.str().size() + 1;
82 uint32_t Size = sizeof(ModuleInfoHeader) + M + O;
83 Size = alignTo(Size, 4);
84 return Size;
85}
Provides read only access to a subclass of BinaryStream.
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
LLVM_ABI Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM_ABI uint32_t getSymbolDebugInfoByteSize() const
LLVM_ABI const SectionContrib & getSectionContrib() const
LLVM_ABI uint32_t getRecordLength() const
LLVM_ABI uint32_t getPdbFilePathNameIndex() const
LLVM_ABI uint32_t getC13LineInfoByteSize() const
LLVM_ABI uint32_t getNumberOfFiles() const
LLVM_ABI uint32_t getSourceFileNameIndex() const
LLVM_ABI uint16_t getTypeServerIndex() const
static LLVM_ABI Error initialize(BinaryStreamRef Stream, DbiModuleDescriptor &Info)
LLVM_ABI StringRef getObjFileName() const
LLVM_ABI uint16_t getModuleStreamIndex() const
LLVM_ABI StringRef getModuleName() const
LLVM_ABI uint32_t getC11LineInfoByteSize() const
This is an optimization pass for GlobalISel generic memory operations.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:155
static const uint16_t TypeServerIndexShift
Definition RawTypes.h:207
static const uint16_t HasECFlagMask
uint16_t fWritten : 1; // True if DbiModuleDescriptor is dirty uint16_t fECEnabled : 1; // Is EC symb...
Definition RawTypes.h:204
static const uint16_t TypeServerIndexMask
Definition RawTypes.h:206
The header preceding each entry in the Module Info substream of the DBI stream.
Definition RawTypes.h:212