[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
[llvm-core.git] / include / llvm / DebugInfo / CodeView / ContinuationRecordBuilder.h
blob53ab2dd04aa7d023badc947fae8b41cb1d530397
1 //===- ContinuationRecordBuilder.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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_CONTINUATIONRECORDBUILDER_H
10 #define LLVM_DEBUGINFO_CODEVIEW_CONTINUATIONRECORDBUILDER_H
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/DebugInfo/CodeView/CodeView.h"
16 #include "llvm/DebugInfo/CodeView/RecordSerialization.h"
17 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
18 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
19 #include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
20 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
21 #include "llvm/Support/Allocator.h"
22 #include "llvm/Support/BinaryByteStream.h"
23 #include "llvm/Support/BinaryStreamWriter.h"
24 #include "llvm/Support/Error.h"
25 #include <cassert>
26 #include <cstdint>
27 #include <memory>
28 #include <vector>
30 namespace llvm {
31 namespace codeview {
32 enum class ContinuationRecordKind { FieldList, MethodOverloadList };
34 class ContinuationRecordBuilder {
35 SmallVector<uint32_t, 4> SegmentOffsets;
36 Optional<ContinuationRecordKind> Kind;
37 AppendingBinaryByteStream Buffer;
38 BinaryStreamWriter SegmentWriter;
39 TypeRecordMapping Mapping;
40 ArrayRef<uint8_t> InjectedSegmentBytes;
42 uint32_t getCurrentSegmentLength() const;
44 void insertSegmentEnd(uint32_t Offset);
45 CVType createSegmentRecord(uint32_t OffBegin, uint32_t OffEnd,
46 Optional<TypeIndex> RefersTo);
48 public:
49 ContinuationRecordBuilder();
50 ~ContinuationRecordBuilder();
52 void begin(ContinuationRecordKind RecordKind);
54 // This template is explicitly instantiated in the implementation file for all
55 // supported types. The method itself is ugly, so inlining it into the header
56 // file clutters an otherwise straightforward interface.
57 template <typename RecordType> void writeMemberType(RecordType &Record);
59 std::vector<CVType> end(TypeIndex Index);
61 } // namespace codeview
62 } // namespace llvm
64 #endif