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