/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/COFF/TypeMerger.h
Line | Count | Source |
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 | | |
17 | | namespace lld { |
18 | | namespace coff { |
19 | | |
20 | | class TypeMerger { |
21 | | public: |
22 | | TypeMerger(llvm::BumpPtrAllocator &alloc) |
23 | | : typeTable(alloc), iDTable(alloc), globalTypeTable(alloc), |
24 | 110 | globalIDTable(alloc) {} |
25 | | |
26 | | /// Get the type table or the global type table if /DEBUG:GHASH is enabled. |
27 | 112 | inline llvm::codeview::TypeCollection &getTypeTable() { |
28 | 112 | if (config->debugGHashes) |
29 | 2 | return globalTypeTable; |
30 | 110 | return typeTable; |
31 | 110 | } |
32 | | |
33 | | /// Get the ID table or the global ID table if /DEBUG:GHASH is enabled. |
34 | 1.51k | inline llvm::codeview::TypeCollection &getIDTable() { |
35 | 1.51k | if (config->debugGHashes) |
36 | 46 | return globalIDTable; |
37 | 1.47k | return iDTable; |
38 | 1.47k | } |
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. |
55 | | struct 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 |