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 TypeServerHandler;
23 class TypeTableBuilder;
25 /// \brief Merge one set of type records into another. This method assumes
26 /// that all records are type records, and there are no Id records present.
28 /// \param Dest The table to store the re-written type records into.
30 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
31 /// type stream, that contains the index of the corresponding type record
32 /// in the destination stream.
34 /// \param Handler (optional) If non-null, an interface that gets invoked
35 /// to handle type server records.
37 /// \param Types The collection of types to merge in.
39 /// \returns Error::success() if the operation succeeded, otherwise an
40 /// appropriate error code.
41 Error mergeTypeRecords(TypeTableBuilder &Dest,
42 SmallVectorImpl<TypeIndex> &SourceToDest,
43 TypeServerHandler *Handler, const CVTypeArray &Types);
45 /// \brief Merge one set of id records into another. This method assumes
46 /// that all records are id records, and there are no Type records present.
47 /// However, since Id records can refer back to Type records, this method
48 /// assumes that the referenced type records have also been merged into
49 /// another type stream (for example using the above method), and accepts
50 /// the mapping from source to dest for that stream so that it can re-write
51 /// the type record mappings accordingly.
53 /// \param Dest The table to store the re-written id records into.
55 /// \param Types The mapping to use for the type records that these id
58 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
59 /// id stream, that contains the index of the corresponding id record
60 /// in the destination stream.
62 /// \param Ids The collection of id records to merge in.
64 /// \returns Error::success() if the operation succeeded, otherwise an
65 /// appropriate error code.
66 Error mergeIdRecords(TypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
67 SmallVectorImpl<TypeIndex> &SourceToDest,
68 const CVTypeArray &Ids);
70 /// \brief Merge a unified set of type and id records, splitting them into
71 /// separate output streams.
73 /// \param DestIds The table to store the re-written id records into.
75 /// \param DestTypes the table to store the re-written type records into.
77 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
78 /// id stream, that contains the index of the corresponding id record
79 /// in the destination stream.
81 /// \param Handler (optional) If non-null, an interface that gets invoked
82 /// to handle type server records.
84 /// \param IdsAndTypes The collection of id records to merge in.
86 /// \returns Error::success() if the operation succeeded, otherwise an
87 /// appropriate error code.
88 Error mergeTypeAndIdRecords(TypeTableBuilder &DestIds,
89 TypeTableBuilder &DestTypes,
90 SmallVectorImpl<TypeIndex> &SourceToDest,
91 TypeServerHandler *Handler,
92 const CVTypeArray &IdsAndTypes);
94 } // end namespace codeview
95 } // end namespace llvm
97 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H