1 //===- TypeStreamMerger.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
16 #include "llvm/Support/Error.h"
22 struct GloballyHashedType;
23 class GlobalTypeTableBuilder;
24 class MergingTypeTableBuilder;
26 /// Merge one set of type records into another. This method assumes
27 /// that all records are type records, and there are no Id records present.
29 /// \param Dest The table to store the re-written type records into.
31 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
32 /// type stream, that contains the index of the corresponding type record
33 /// in the destination stream.
35 /// \param Types The collection of types to merge in.
37 /// \returns Error::success() if the operation succeeded, otherwise an
38 /// appropriate error code.
39 Error mergeTypeRecords(MergingTypeTableBuilder &Dest,
40 SmallVectorImpl<TypeIndex> &SourceToDest,
41 const CVTypeArray &Types);
43 /// Merge one set of id records into another. This method assumes
44 /// that all records are id records, and there are no Type records present.
45 /// However, since Id records can refer back to Type records, this method
46 /// assumes that the referenced type records have also been merged into
47 /// another type stream (for example using the above method), and accepts
48 /// the mapping from source to dest for that stream so that it can re-write
49 /// the type record mappings accordingly.
51 /// \param Dest The table to store the re-written id records into.
53 /// \param Types The mapping to use for the type records that these id
56 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
57 /// id stream, that contains the index of the corresponding id record
58 /// in the destination stream.
60 /// \param Ids The collection of id records to merge in.
62 /// \returns Error::success() if the operation succeeded, otherwise an
63 /// appropriate error code.
64 Error mergeIdRecords(MergingTypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
65 SmallVectorImpl<TypeIndex> &SourceToDest,
66 const CVTypeArray &Ids);
68 /// Merge a unified set of type and id records, splitting them into
69 /// separate output streams.
71 /// \param DestIds The table to store the re-written id records into.
73 /// \param DestTypes the table to store the re-written type records into.
75 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
76 /// id stream, that contains the index of the corresponding id record
77 /// in the destination stream.
79 /// \param IdsAndTypes The collection of id records to merge in.
81 /// \returns Error::success() if the operation succeeded, otherwise an
82 /// appropriate error code.
83 Error mergeTypeAndIdRecords(MergingTypeTableBuilder &DestIds,
84 MergingTypeTableBuilder &DestTypes,
85 SmallVectorImpl<TypeIndex> &SourceToDest,
86 const CVTypeArray &IdsAndTypes,
87 Optional<uint32_t> &PCHSignature);
89 Error mergeTypeAndIdRecords(GlobalTypeTableBuilder &DestIds,
90 GlobalTypeTableBuilder &DestTypes,
91 SmallVectorImpl<TypeIndex> &SourceToDest,
92 const CVTypeArray &IdsAndTypes,
93 ArrayRef<GloballyHashedType> Hashes,
94 Optional<uint32_t> &PCHSignature);
96 Error mergeTypeRecords(GlobalTypeTableBuilder &Dest,
97 SmallVectorImpl<TypeIndex> &SourceToDest,
98 const CVTypeArray &Types,
99 ArrayRef<GloballyHashedType> Hashes,
100 Optional<uint32_t> &PCHSignature);
102 Error mergeIdRecords(GlobalTypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
103 SmallVectorImpl<TypeIndex> &SourceToDest,
104 const CVTypeArray &Ids,
105 ArrayRef<GloballyHashedType> Hashes);
107 } // end namespace codeview
108 } // end namespace llvm
110 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H