LLVM  8.0.1
TypeStreamMerger.h
Go to the documentation of this file.
1 //===- TypeStreamMerger.h ---------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
12 
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/Support/Error.h"
17 
18 namespace llvm {
19 namespace codeview {
20 
21 class TypeIndex;
22 struct GloballyHashedType;
23 class GlobalTypeTableBuilder;
24 class MergingTypeTableBuilder;
25 
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.
28 ///
29 /// \param Dest The table to store the re-written type records into.
30 ///
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.
34 ///
35 /// \param Types The collection of types to merge in.
36 ///
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);
42 
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.
50 ///
51 /// \param Dest The table to store the re-written id records into.
52 ///
53 /// \param Types The mapping to use for the type records that these id
54 /// records refer to.
55 ///
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.
59 ///
60 /// \param Ids The collection of id records to merge in.
61 ///
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);
67 
68 /// Merge a unified set of type and id records, splitting them into
69 /// separate output streams.
70 ///
71 /// \param DestIds The table to store the re-written id records into.
72 ///
73 /// \param DestTypes the table to store the re-written type records into.
74 ///
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.
78 ///
79 /// \param IdsAndTypes The collection of id records to merge in.
80 ///
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);
88 
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);
95 
96 Error mergeTypeRecords(GlobalTypeTableBuilder &Dest,
97  SmallVectorImpl<TypeIndex> &SourceToDest,
98  const CVTypeArray &Types,
99  ArrayRef<GloballyHashedType> Hashes,
100  Optional<uint32_t> &PCHSignature);
101 
102 Error mergeIdRecords(GlobalTypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
103  SmallVectorImpl<TypeIndex> &SourceToDest,
104  const CVTypeArray &Ids,
105  ArrayRef<GloballyHashedType> Hashes);
106 
107 } // end namespace codeview
108 } // end namespace llvm
109 
110 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
VarStreamArray< CVType > CVTypeArray
Definition: TypeRecord.h:43
Error mergeTypeRecords(MergingTypeTableBuilder &Dest, SmallVectorImpl< TypeIndex > &SourceToDest, const CVTypeArray &Types)
Merge one set of type records into another.
Error mergeTypeAndIdRecords(MergingTypeTableBuilder &DestIds, MergingTypeTableBuilder &DestTypes, SmallVectorImpl< TypeIndex > &SourceToDest, const CVTypeArray &IdsAndTypes, Optional< uint32_t > &PCHSignature)
Merge a unified set of type and id records, splitting them into separate output streams.
Error mergeIdRecords(MergingTypeTableBuilder &Dest, ArrayRef< TypeIndex > Types, SmallVectorImpl< TypeIndex > &SourceToDest, const CVTypeArray &Ids)
Merge one set of id records into another.