32 ParentAddr(ParentAddr) {}
43static std::optional<InlineeSourceLine>
46 if (SS.kind() != DebugSubsectionKind::InlineeLines)
57 if (
Line.Header->Inlinee == Id)
79 if (InlineeType.
kind() == LF_MFUNC_ID) {
81 cantFail(TypeDeserializer::deserializeAs<MemberFuncIdRecord>(InlineeType,
84 QualifiedName.append(std::string(Types.getTypeName(ClassTy)));
86 }
else if (InlineeType.
kind() == LF_FUNC_ID) {
89 TypeDeserializer::deserializeAs<FuncIdRecord>(InlineeType, FRecord));
101void NativeInlineSiteSymbol::getLineOffset(
uint32_t OffsetInFunc,
107 std::optional<uint32_t> CodeOffsetBase;
108 std::optional<uint32_t> CodeOffsetEnd;
109 std::optional<int32_t> CurLineOffset;
110 std::optional<int32_t> NextLineOffset;
111 std::optional<uint32_t> NextFileOffset;
112 auto UpdateCodeOffset = [&](
uint32_t Delta) {
115 else if (!CodeOffsetEnd)
116 CodeOffsetEnd = *CodeOffsetBase + Delta;
118 auto UpdateLineOffset = [&](int32_t Delta) {
120 if (!CodeOffsetBase || !CurLineOffset)
121 CurLineOffset = LineOffset;
123 NextLineOffset = LineOffset;
131 auto ValidateAndReset = [&]() {
133 if (CodeOffsetBase && CodeOffsetEnd && CurLineOffset) {
134 if (CodeOffsetBase <= OffsetInFunc && OffsetInFunc < CodeOffsetEnd) {
135 LineOffset = *CurLineOffset;
140 FileOffset = *NextFileOffset;
141 if (NextLineOffset) {
142 CurLineOffset = NextLineOffset;
143 NextLineOffset = std::nullopt;
145 CodeOffsetBase = CodeOffsetEnd;
146 CodeOffsetEnd = NextFileOffset = std::nullopt;
151 switch (Annot.OpCode) {
152 case BinaryAnnotationsOpCode::CodeOffset:
153 case BinaryAnnotationsOpCode::ChangeCodeOffset:
154 case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
156 UpdateCodeOffset(Annot.U1);
158 case BinaryAnnotationsOpCode::ChangeCodeLength:
159 UpdateCodeOffset(Annot.U1);
161 case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset:
163 UpdateCodeOffset(Annot.U2);
164 UpdateCodeOffset(Annot.U1);
166 case BinaryAnnotationsOpCode::ChangeLineOffset:
167 UpdateLineOffset(Annot.S1);
169 case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset:
171 UpdateCodeOffset(Annot.U1);
172 UpdateLineOffset(Annot.S1);
174 case BinaryAnnotationsOpCode::ChangeFile:
175 UpdateFileOffset(Annot.U1);
181 if (ValidateAndReset())
186std::unique_ptr<IPDBEnumLineNumbers>
200 ModS->findChecksumsSubsection();
209 getLineOffset(VA - ParentAddr, SrcLineOffset, SrcFileOffset);
212 std::optional<InlineeSourceLine>
Inlinee =
221 (SrcFileOffset == 0) ?
Inlinee->Header->FileID : SrcFileOffset;
223 auto ChecksumIter = Checksums->getArray().at(FileChecksumOffset);
232 std::vector<NativeLineNumber>
Lines{LineNum};
234 return std::make_unique<NativeEnumLineNumbers>(std::move(
Lines));
static std::optional< InlineeSourceLine > findInlineeByTypeIndex(TypeIndex Id, ModuleDebugStreamRef &ModS)
Provides read only access to a subclass of BinaryStream.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
TypeIndex getParentScope() const
iterator_range< BinaryAnnotationIterator > annotations() const
Provides amortized O(1) random access to a CodeView type stream.
CVType getType(TypeIndex Index) override
StringRef getTypeName(TypeIndex Index) override
TypeIndex getClassType() const
codeview::DebugSubsectionArray getSubsectionsArray() const
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override
NativeInlineSiteSymbol(NativeSession &Session, SymIndexId Id, const codeview::InlineSiteSym &Sym, uint64_t ParentAddr)
std::string getName() const override
void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, PdbSymbolIdField RecurseIdFields) const override
~NativeInlineSiteSymbol() override
void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, PdbSymbolIdField RecurseIdFields) const override
SymbolCache & getSymbolCache()
bool addressForVA(uint64_t VA, uint32_t &Section, uint32_t &Offset) const override
Expected< ModuleDebugStreamRef > getModuleDebugStream(uint32_t Index) const
bool moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const
Expected< TpiStream & > getPDBIpiStream()
Expected< TpiStream & > getPDBTpiStream()
SymIndexId getOrCreateSourceFile(const codeview::FileChecksumEntry &Checksum) const
std::unique_ptr< IPDBSourceFile > getSourceFileById(SymIndexId FileId) const
This class implements an extremely fast bulk output stream that can only output to a stream.
void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent)
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn....
This is an optimization pass for GlobalISel generic memory operations.
std::tuple< uint64_t, uint32_t > InlineSite
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
void consumeError(Error Err)
Consume a Error without doing anything.