]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / CodeView / DebugFrameDataSubsection.h
1 //===- DebugFrameDataSubsection.h ------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
11 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
12
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
15 #include "llvm/Support/BinaryStreamReader.h"
16 #include "llvm/Support/Endian.h"
17 #include "llvm/Support/Error.h"
18
19 namespace llvm {
20 namespace codeview {
21 class DebugFrameDataSubsectionRef final : public DebugSubsectionRef {
22 public:
23   DebugFrameDataSubsectionRef()
24       : DebugSubsectionRef(DebugSubsectionKind::FrameData) {}
25   static bool classof(const DebugSubsection *S) {
26     return S->kind() == DebugSubsectionKind::FrameData;
27   }
28
29   Error initialize(BinaryStreamReader Reader);
30   Error initialize(BinaryStreamRef Stream);
31
32   FixedStreamArray<FrameData>::Iterator begin() const { return Frames.begin(); }
33   FixedStreamArray<FrameData>::Iterator end() const { return Frames.end(); }
34
35   const support::ulittle32_t *getRelocPtr() const { return RelocPtr; }
36
37 private:
38   const support::ulittle32_t *RelocPtr = nullptr;
39   FixedStreamArray<FrameData> Frames;
40 };
41
42 class DebugFrameDataSubsection final : public DebugSubsection {
43 public:
44   DebugFrameDataSubsection(bool IncludeRelocPtr)
45       : DebugSubsection(DebugSubsectionKind::FrameData),
46         IncludeRelocPtr(IncludeRelocPtr) {}
47   static bool classof(const DebugSubsection *S) {
48     return S->kind() == DebugSubsectionKind::FrameData;
49   }
50
51   uint32_t calculateSerializedSize() const override;
52   Error commit(BinaryStreamWriter &Writer) const override;
53
54   void addFrameData(const FrameData &Frame);
55   void setFrames(ArrayRef<FrameData> Frames);
56
57 private:
58   bool IncludeRelocPtr = false;
59   std::vector<FrameData> Frames;
60 };
61 }
62 }
63
64 #endif