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