LLVM  9.0.0svn
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"
20 #include "llvm/Support/Endian.h"
21 #include "llvm/Support/Error.h"
22 #include <cstdint>
23 #include <vector>
24 
25 namespace llvm {
26 
27 namespace codeview {
28 
29 class DebugChecksumsSubsection;
30 
32  Normal, // CV_INLINEE_SOURCE_LINE_SIGNATURE
33  ExtraFiles // CV_INLINEE_SOURCE_LINE_SIGNATURE_EX
34 };
35 
37  TypeIndex Inlinee; // ID of the function that was inlined.
38  support::ulittle32_t FileID; // Offset into FileChecksums subsection.
39  support::ulittle32_t SourceLineNum; // First line of inlined code.
40  // If extra files present:
41  // ulittle32_t ExtraFileCount;
42  // ulittle32_t Files[];
43 };
44 
48 };
49 
50 } // end namespace codeview
51 
52 template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
53  Error operator()(BinaryStreamRef Stream, uint32_t &Len,
55 
56  bool HasExtraFiles = false;
57 };
58 
59 namespace codeview {
60 
64 
65 public:
67 
68  static bool classof(const DebugSubsectionRef *S) {
70  }
71 
73  bool hasExtraFiles() const;
74 
75  Iterator begin() const { return Lines.begin(); }
76  Iterator end() const { return Lines.end(); }
77 
78 private:
79  InlineeLinesSignature Signature;
81 };
82 
84 public:
85  struct Entry {
86  std::vector<support::ulittle32_t> ExtraFiles;
88  };
89 
91  bool HasExtraFiles = false);
92 
93  static bool classof(const DebugSubsection *S) {
95  }
96 
97  Error commit(BinaryStreamWriter &Writer) const override;
98  uint32_t calculateSerializedSize() const override;
99 
100  void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t SourceLine);
101  void addExtraFile(StringRef FileName);
102 
103  bool hasExtraFiles() const { return HasExtraFiles; }
104  void setHasExtraFiles(bool Has) { HasExtraFiles = Has; }
105 
106  std::vector<Entry>::const_iterator begin() const { return Entries.begin(); }
107  std::vector<Entry>::const_iterator end() const { return Entries.end(); }
108 
109 private:
110  DebugChecksumsSubsection &Checksums;
111  bool HasExtraFiles = false;
112  uint32_t ExtraFileCount = 0;
113  std::vector<Entry> Entries;
114 };
115 
116 } // end namespace codeview
117 
118 } // end namespace llvm
119 
120 #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
Profile::FuncID FuncId
Definition: Profile.cpp:320
This class represents lattice values for constants.
Definition: AllocatorList.h:23
static bool classof(const DebugSubsectionRef *S)
std::vector< Entry >::const_iterator end() const
VarStreamArrayExtractor is intended to be specialized to provide customized extraction logic...
std::vector< Entry >::const_iterator begin() const
A 32-bit type reference.
Definition: TypeIndex.h:95
static bool classof(const DebugSubsection *S)
Provides write only access to a subclass of WritableBinaryStream.
const InlineeSourceLineHeader * Header
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
VarStreamArray represents an array of variable length records backed by a stream. ...
DebugSubsectionKind kind() const
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringRef > StandardNames)
Initialize the set of available library functions based on the specified target triple.
FixedStreamArray< support::ulittle32_t > ExtraFiles
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
DebugSubsectionKind kind() const