xref: /freebsd/contrib/llvm-project/llvm/include/llvm/DebugInfo/CodeView/DebugSubsection.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===- DebugSubsection.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_DEBUGSUBSECTION_H
10 #define LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTION_H
11 
12 #include "llvm/DebugInfo/CodeView/CodeView.h"
13 #include "llvm/Support/Compiler.h"
14 #include "llvm/Support/Error.h"
15 
16 #include <cstdint>
17 
18 namespace llvm {
19 class BinaryStreamWriter;
20 namespace codeview {
21 
22 class LLVM_ABI DebugSubsectionRef {
23 public:
DebugSubsectionRef(DebugSubsectionKind Kind)24   explicit DebugSubsectionRef(DebugSubsectionKind Kind) : Kind(Kind) {}
25   virtual ~DebugSubsectionRef();
26 
classof(const DebugSubsectionRef * S)27   static bool classof(const DebugSubsectionRef *S) { return true; }
28 
kind()29   DebugSubsectionKind kind() const { return Kind; }
30 
31 protected:
32   DebugSubsectionKind Kind;
33 };
34 
35 class LLVM_ABI DebugSubsection {
36 public:
DebugSubsection(DebugSubsectionKind Kind)37   explicit DebugSubsection(DebugSubsectionKind Kind) : Kind(Kind) {}
38   virtual ~DebugSubsection();
39 
classof(const DebugSubsection * S)40   static bool classof(const DebugSubsection *S) { return true; }
41 
kind()42   DebugSubsectionKind kind() const { return Kind; }
43 
44   virtual Error commit(BinaryStreamWriter &Writer) const = 0;
45   virtual uint32_t calculateSerializedSize() const = 0;
46 
47 protected:
48   DebugSubsectionKind Kind;
49 };
50 
51 } // namespace codeview
52 } // namespace llvm
53 
54 #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTION_H
55