Home | History | Annotate | Download | only in CodeView
      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"
     15 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
     16 #include "llvm/Support/Error.h"
     17 
     18 namespace llvm {
     19 namespace codeview {
     20 
     21 class TypeIndex;
     22 class TypeTableBuilder;
     23 
     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.
     26 ///
     27 /// \param Dest The table to store the re-written type records into.
     28 ///
     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.
     32 ///
     33 /// \param Types The collection of types to merge in.
     34 ///
     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);
     40 
     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.
     48 ///
     49 /// \param Dest The table to store the re-written id records into.
     50 ///
     51 /// \param Types The mapping to use for the type records that these id
     52 /// records refer to.
     53 ///
     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.
     57 ///
     58 /// \param Ids The collection of id records to merge in.
     59 ///
     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);
     65 
     66 /// \brief Merge a unified set of type and id records, splitting them into
     67 /// separate output streams.
     68 ///
     69 /// \param DestIds The table to store the re-written id records into.
     70 ///
     71 /// \param DestTypes the table to store the re-written type records into.
     72 ///
     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.
     76 ///
     77 /// \param IdsAndTypes The collection of id records to merge in.
     78 ///
     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);
     85 
     86 } // end namespace codeview
     87 } // end namespace llvm
     88 
     89 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
     90