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 class TypeTableBuilder;
24 /// \brief Merge one set of type records into another. This method assumes
25 /// that all records are type records, and there are no Id records present.
27 /// \param Dest The table to store the re-written type records into.
29 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
30 /// type stream, that contains the index of the corresponding type record
31 /// in the destination stream.
33 /// \param Types The collection of types to merge in.
35 /// \returns Error::success() if the operation succeeded, otherwise an
36 /// appropriate error code.
37 Error mergeTypeRecords(TypeTableBuilder &Dest,
38 SmallVectorImpl<TypeIndex> &SourceToDest,
39 const CVTypeArray &Types);
41 /// \brief Merge one set of id records into another. This method assumes
42 /// that all records are id records, and there are no Type records present.
43 /// However, since Id records can refer back to Type records, this method
44 /// assumes that the referenced type records have also been merged into
45 /// another type stream (for example using the above method), and accepts
46 /// the mapping from source to dest for that stream so that it can re-write
47 /// the type record mappings accordingly.
49 /// \param Dest The table to store the re-written id records into.
51 /// \param Types The mapping to use for the type records that these id
54 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
55 /// id stream, that contains the index of the corresponding id record
56 /// in the destination stream.
58 /// \param Ids The collection of id records to merge in.
60 /// \returns Error::success() if the operation succeeded, otherwise an
61 /// appropriate error code.
62 Error mergeIdRecords(TypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
63 SmallVectorImpl<TypeIndex> &SourceToDest,
64 const CVTypeArray &Ids);
66 /// \brief Merge a unified set of type and id records, splitting them into
67 /// separate output streams.
69 /// \param DestIds The table to store the re-written id records into.
71 /// \param DestTypes the table to store the re-written type records into.
73 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
74 /// id stream, that contains the index of the corresponding id record
75 /// in the destination stream.
77 /// \param IdsAndTypes The collection of id records to merge in.
79 /// \returns Error::success() if the operation succeeded, otherwise an
80 /// appropriate error code.
81 Error mergeTypeAndIdRecords(TypeTableBuilder &DestIds,
82 TypeTableBuilder &DestTypes,
83 SmallVectorImpl<TypeIndex> &SourceToDest,
84 const CVTypeArray &IdsAndTypes);
86 } // end namespace codeview
87 } // end namespace llvm
89 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H