TypeMerger.h revision 1.1.1.1
1//===- TypeMerger.h ---------------------------------------------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef LLD_COFF_TYPEMERGER_H 10#define LLD_COFF_TYPEMERGER_H 11 12#include "Config.h" 13#include "llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h" 14#include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h" 15#include "llvm/Support/Allocator.h" 16 17namespace lld { 18namespace coff { 19 20class TypeMerger { 21public: 22 TypeMerger(llvm::BumpPtrAllocator &alloc) 23 : typeTable(alloc), iDTable(alloc), globalTypeTable(alloc), 24 globalIDTable(alloc) {} 25 26 /// Get the type table or the global type table if /DEBUG:GHASH is enabled. 27 inline llvm::codeview::TypeCollection &getTypeTable() { 28 if (config->debugGHashes) 29 return globalTypeTable; 30 return typeTable; 31 } 32 33 /// Get the ID table or the global ID table if /DEBUG:GHASH is enabled. 34 inline llvm::codeview::TypeCollection &getIDTable() { 35 if (config->debugGHashes) 36 return globalIDTable; 37 return iDTable; 38 } 39 40 /// Type records that will go into the PDB TPI stream. 41 llvm::codeview::MergingTypeTableBuilder typeTable; 42 43 /// Item records that will go into the PDB IPI stream. 44 llvm::codeview::MergingTypeTableBuilder iDTable; 45 46 /// Type records that will go into the PDB TPI stream (for /DEBUG:GHASH) 47 llvm::codeview::GlobalTypeTableBuilder globalTypeTable; 48 49 /// Item records that will go into the PDB IPI stream (for /DEBUG:GHASH) 50 llvm::codeview::GlobalTypeTableBuilder globalIDTable; 51}; 52 53/// Map from type index and item index in a type server PDB to the 54/// corresponding index in the destination PDB. 55struct CVIndexMap { 56 llvm::SmallVector<llvm::codeview::TypeIndex, 0> tpiMap; 57 llvm::SmallVector<llvm::codeview::TypeIndex, 0> ipiMap; 58 bool isTypeServerMap = false; 59 bool isPrecompiledTypeMap = false; 60}; 61 62} // namespace coff 63} // namespace lld 64 65#endif