Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:40

0001 //===- TypeStreamMerger.h ---------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
0010 #define LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
0011 
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/DebugInfo/CodeView/CVRecord.h"
0014 #include "llvm/Support/Error.h"
0015 
0016 namespace llvm {
0017 template <typename T> class SmallVectorImpl;
0018 namespace codeview {
0019 
0020 class TypeIndex;
0021 struct GloballyHashedType;
0022 class GlobalTypeTableBuilder;
0023 class MergingTypeTableBuilder;
0024 
0025 /// Used to forward information about PCH.OBJ (precompiled) files, when
0026 /// applicable.
0027 struct PCHMergerInfo {
0028   uint32_t PCHSignature{};
0029   uint32_t EndPrecompIndex = ~0U;
0030 };
0031 
0032 /// Merge one set of type records into another.  This method assumes
0033 /// that all records are type records, and there are no Id records present.
0034 ///
0035 /// \param Dest The table to store the re-written type records into.
0036 ///
0037 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
0038 /// type stream, that contains the index of the corresponding type record
0039 /// in the destination stream.
0040 ///
0041 /// \param Types The collection of types to merge in.
0042 ///
0043 /// \returns Error::success() if the operation succeeded, otherwise an
0044 /// appropriate error code.
0045 Error mergeTypeRecords(MergingTypeTableBuilder &Dest,
0046                        SmallVectorImpl<TypeIndex> &SourceToDest,
0047                        const CVTypeArray &Types);
0048 
0049 /// Merge one set of id records into another.  This method assumes
0050 /// that all records are id records, and there are no Type records present.
0051 /// However, since Id records can refer back to Type records, this method
0052 /// assumes that the referenced type records have also been merged into
0053 /// another type stream (for example using the above method), and accepts
0054 /// the mapping from source to dest for that stream so that it can re-write
0055 /// the type record mappings accordingly.
0056 ///
0057 /// \param Dest The table to store the re-written id records into.
0058 ///
0059 /// \param Types The mapping to use for the type records that these id
0060 /// records refer to.
0061 ///
0062 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
0063 /// id stream, that contains the index of the corresponding id record
0064 /// in the destination stream.
0065 ///
0066 /// \param Ids The collection of id records to merge in.
0067 ///
0068 /// \returns Error::success() if the operation succeeded, otherwise an
0069 /// appropriate error code.
0070 Error mergeIdRecords(MergingTypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
0071                      SmallVectorImpl<TypeIndex> &SourceToDest,
0072                      const CVTypeArray &Ids);
0073 
0074 /// Merge a unified set of type and id records, splitting them into
0075 /// separate output streams.
0076 ///
0077 /// \param DestIds The table to store the re-written id records into.
0078 ///
0079 /// \param DestTypes the table to store the re-written type records into.
0080 ///
0081 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
0082 /// id stream, that contains the index of the corresponding id record
0083 /// in the destination stream.
0084 ///
0085 /// \param IdsAndTypes The collection of id records to merge in.
0086 ///
0087 /// \returns Error::success() if the operation succeeded, otherwise an
0088 /// appropriate error code.
0089 Error mergeTypeAndIdRecords(MergingTypeTableBuilder &DestIds,
0090                             MergingTypeTableBuilder &DestTypes,
0091                             SmallVectorImpl<TypeIndex> &SourceToDest,
0092                             const CVTypeArray &IdsAndTypes,
0093                             std::optional<PCHMergerInfo> &PCHInfo);
0094 
0095 Error mergeTypeAndIdRecords(GlobalTypeTableBuilder &DestIds,
0096                             GlobalTypeTableBuilder &DestTypes,
0097                             SmallVectorImpl<TypeIndex> &SourceToDest,
0098                             const CVTypeArray &IdsAndTypes,
0099                             ArrayRef<GloballyHashedType> Hashes,
0100                             std::optional<PCHMergerInfo> &PCHInfo);
0101 
0102 Error mergeTypeRecords(GlobalTypeTableBuilder &Dest,
0103                        SmallVectorImpl<TypeIndex> &SourceToDest,
0104                        const CVTypeArray &Types,
0105                        ArrayRef<GloballyHashedType> Hashes,
0106                        std::optional<PCHMergerInfo> &PCHInfo);
0107 
0108 Error mergeIdRecords(GlobalTypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
0109                      SmallVectorImpl<TypeIndex> &SourceToDest,
0110                      const CVTypeArray &Ids,
0111                      ArrayRef<GloballyHashedType> Hashes);
0112 
0113 } // end namespace codeview
0114 } // end namespace llvm
0115 
0116 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H