LLVM  16.0.0git
DebugInlineeLinesSubsection.h
Go to the documentation of this file.
1 //===- DebugInlineeLinesSubsection.h ----------------------------*- 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_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
10 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
11 
12 #include "llvm/ADT/StringRef.h"
19 #include "llvm/Support/Endian.h"
20 #include "llvm/Support/Error.h"
21 #include <cstdint>
22 #include <vector>
23 
24 namespace llvm {
25 
26 namespace codeview {
27 
28 class DebugChecksumsSubsection;
29 
31  Normal, // CV_INLINEE_SOURCE_LINE_SIGNATURE
32  ExtraFiles // CV_INLINEE_SOURCE_LINE_SIGNATURE_EX
33 };
34 
36  TypeIndex Inlinee; // ID of the function that was inlined.
37  support::ulittle32_t FileID; // Offset into FileChecksums subsection.
38  support::ulittle32_t SourceLineNum; // First line of inlined code.
39  // If extra files present:
40  // ulittle32_t ExtraFileCount;
41  // ulittle32_t Files[];
42 };
43 
47 };
48 
49 } // end namespace codeview
50 
51 template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
54 
55  bool HasExtraFiles = false;
56 };
57 
58 namespace codeview {
59 
63 
64 public:
66 
67  static bool classof(const DebugSubsectionRef *S) {
68  return S->kind() == DebugSubsectionKind::InlineeLines;
69  }
70 
73  return initialize(BinaryStreamReader(Section));
74  }
75 
76  bool valid() const { return Lines.valid(); }
77  bool hasExtraFiles() const;
78 
79  Iterator begin() const { return Lines.begin(); }
80  Iterator end() const { return Lines.end(); }
81 
82 private:
83  InlineeLinesSignature Signature;
84  LinesArray Lines;
85 };
86 
88 public:
89  struct Entry {
90  std::vector<support::ulittle32_t> ExtraFiles;
92  };
93 
95  bool HasExtraFiles = false);
96 
97  static bool classof(const DebugSubsection *S) {
98  return S->kind() == DebugSubsectionKind::InlineeLines;
99  }
100 
101  Error commit(BinaryStreamWriter &Writer) const override;
102  uint32_t calculateSerializedSize() const override;
103 
104  void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t SourceLine);
105  void addExtraFile(StringRef FileName);
106 
107  bool hasExtraFiles() const { return HasExtraFiles; }
108  void setHasExtraFiles(bool Has) { HasExtraFiles = Has; }
109 
110  std::vector<Entry>::const_iterator begin() const { return Entries.begin(); }
111  std::vector<Entry>::const_iterator end() const { return Entries.end(); }
112 
113 private:
114  DebugChecksumsSubsection &Checksums;
115  bool HasExtraFiles = false;
116  uint32_t ExtraFileCount = 0;
117  std::vector<Entry> Entries;
118 };
119 
120 } // end namespace codeview
121 
122 } // end namespace llvm
123 
124 #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
llvm::codeview::DebugInlineeLinesSubsection::begin
std::vector< Entry >::const_iterator begin() const
Definition: DebugInlineeLinesSubsection.h:110
BinaryStreamReader.h
llvm::codeview::DebugInlineeLinesSubsection::calculateSerializedSize
uint32_t calculateSerializedSize() const override
Definition: DebugInlineeLinesSubsection.cpp:67
llvm::codeview::InlineeSourceLine
Definition: DebugInlineeLinesSubsection.h:44
llvm::codeview::DebugSubsectionKind::InlineeLines
@ InlineeLines
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::codeview::DebugChecksumsSubsection
Definition: DebugChecksumsSubsection.h:77
llvm::support::detail::packed_endian_specific_integral
Definition: Endian.h:206
StringRef.h
llvm::BinaryStreamWriter
Provides write only access to a subclass of WritableBinaryStream.
Definition: BinaryStreamWriter.h:30
Error.h
llvm::codeview::DebugInlineeLinesSubsection::setHasExtraFiles
void setHasExtraFiles(bool Has)
Definition: DebugInlineeLinesSubsection.h:108
llvm::codeview::DebugInlineeLinesSubsectionRef::classof
static bool classof(const DebugSubsectionRef *S)
Definition: DebugInlineeLinesSubsection.h:67
llvm::codeview::DebugInlineeLinesSubsection::classof
static bool classof(const DebugSubsection *S)
Definition: DebugInlineeLinesSubsection.h:97
llvm::codeview::InlineeLinesSignature::ExtraFiles
@ ExtraFiles
llvm::VarStreamArray::end
Iterator end() const
Definition: BinaryStreamArray.h:117
llvm::VarStreamArrayExtractor
VarStreamArrayExtractor is intended to be specialized to provide customized extraction logic.
Definition: DbiModuleDescriptor.h:18
llvm::codeview::DebugInlineeLinesSubsectionRef::initialize
Error initialize(BinaryStreamRef Section)
Definition: DebugInlineeLinesSubsection.h:72
llvm::FixedStreamArray< support::ulittle32_t >
llvm::codeview::InlineeSourceLine::Header
const InlineeSourceLineHeader * Header
Definition: DebugInlineeLinesSubsection.h:45
llvm::codeview::InlineeSourceLineHeader::FileID
support::ulittle32_t FileID
Definition: DebugInlineeLinesSubsection.h:37
llvm::codeview::DebugInlineeLinesSubsectionRef::initialize
Error initialize(BinaryStreamReader Reader)
Definition: DebugInlineeLinesSubsection.cpp:46
llvm::codeview::InlineeLinesSignature
InlineeLinesSignature
Definition: DebugInlineeLinesSubsection.h:30
llvm::VarStreamArray< InlineeSourceLine >
llvm::codeview::DebugSubsectionRef
Definition: DebugSubsection.h:21
llvm::codeview::DebugInlineeLinesSubsection
Definition: DebugInlineeLinesSubsection.h:87
llvm::codeview::InlineeSourceLineHeader
Definition: DebugInlineeLinesSubsection.h:35
llvm::VarStreamArray< InlineeSourceLine >::Iterator
VarStreamArrayIterator< InlineeSourceLine, VarStreamArrayExtractor< InlineeSourceLine > > Iterator
Definition: BinaryStreamArray.h:96
llvm::VarStreamArrayExtractor::operator()
Error operator()(BinaryStreamRef Stream, uint32_t &Len, T &Item) const =delete
Definition: DebugChecksumsSubsection.cpp:35
llvm::codeview::DebugInlineeLinesSubsectionRef::hasExtraFiles
bool hasExtraFiles() const
Definition: DebugInlineeLinesSubsection.cpp:58
llvm::codeview::DebugInlineeLinesSubsectionRef::begin
Iterator begin() const
Definition: DebugInlineeLinesSubsection.h:79
llvm::codeview::DebugInlineeLinesSubsection::Entry::ExtraFiles
std::vector< support::ulittle32_t > ExtraFiles
Definition: DebugInlineeLinesSubsection.h:90
llvm::codeview::InlineeSourceLine::ExtraFiles
FixedStreamArray< support::ulittle32_t > ExtraFiles
Definition: DebugInlineeLinesSubsection.h:46
CodeView.h
llvm::codeview::DebugInlineeLinesSubsectionRef::end
Iterator end() const
Definition: DebugInlineeLinesSubsection.h:80
llvm::BinaryStreamReader
Provides read only access to a subclass of BinaryStream.
Definition: BinaryStreamReader.h:29
DebugSubsection.h
llvm::codeview::InlineeSourceLineHeader::SourceLineNum
support::ulittle32_t SourceLineNum
Definition: DebugInlineeLinesSubsection.h:38
FuncId
Profile::FuncID FuncId
Definition: Profile.cpp:321
BinaryStreamArray.h
llvm::VarStreamArrayIterator
VarStreamArray represents an array of variable length records backed by a stream.
Definition: BinaryStreamArray.h:88
llvm::codeview::DebugInlineeLinesSubsection::end
std::vector< Entry >::const_iterator end() const
Definition: DebugInlineeLinesSubsection.h:111
llvm::codeview::DebugInlineeLinesSubsection::addInlineSite
void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t SourceLine)
Definition: DebugInlineeLinesSubsection.cpp:116
llvm::codeview::DebugInlineeLinesSubsection::hasExtraFiles
bool hasExtraFiles() const
Definition: DebugInlineeLinesSubsection.h:107
llvm::codeview::DebugInlineeLinesSubsection::Entry
Definition: DebugInlineeLinesSubsection.h:89
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
BinaryStreamRef.h
uint32_t
llvm::codeview::DebugInlineeLinesSubsection::DebugInlineeLinesSubsection
DebugInlineeLinesSubsection(DebugChecksumsSubsection &Checksums, bool HasExtraFiles=false)
Definition: DebugInlineeLinesSubsection.cpp:62
llvm::codeview::DebugInlineeLinesSubsection::Entry::Header
InlineeSourceLineHeader Header
Definition: DebugInlineeLinesSubsection.h:91
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::VarStreamArray::valid
bool valid() const
Definition: BinaryStreamArray.h:112
llvm::VarStreamArray::begin
Iterator begin(bool *HadError=nullptr) const
Definition: BinaryStreamArray.h:108
llvm::codeview::DebugSubsection
Definition: DebugSubsection.h:34
llvm::codeview::InlineeLinesSignature::Normal
@ Normal
llvm::codeview::DebugInlineeLinesSubsectionRef::valid
bool valid() const
Definition: DebugInlineeLinesSubsection.h:76
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
TypeIndex.h
llvm::codeview::DebugInlineeLinesSubsectionRef
Definition: DebugInlineeLinesSubsection.h:60
llvm::codeview::DebugInlineeLinesSubsectionRef::DebugInlineeLinesSubsectionRef
DebugInlineeLinesSubsectionRef()
Definition: DebugInlineeLinesSubsection.cpp:43
llvm::codeview::DebugInlineeLinesSubsection::commit
Error commit(BinaryStreamWriter &Writer) const override
Definition: DebugInlineeLinesSubsection.cpp:84
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:96
Endian.h
llvm::codeview::DebugInlineeLinesSubsection::addExtraFile
void addExtraFile(StringRef FileName)
Definition: DebugInlineeLinesSubsection.cpp:108
llvm::BinaryStreamRef
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Definition: BinaryStreamRef.h:155
llvm::codeview::InlineeSourceLineHeader::Inlinee
TypeIndex Inlinee
Definition: DebugInlineeLinesSubsection.h:36