[LLD][COFF] Fix TypeServerSource matcher with more than one collision
[llvm-project.git] / lld / COFF / COFFLinkerContext.h
bloba3a6f94a941373b75b57a6076c197fb295be8bf3
1 //===- COFFLinkerContext.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 //===----------------------------------------------------------------------===//
9 #ifndef LLD_COFF_COFFLinkerContext_H
10 #define LLD_COFF_COFFLinkerContext_H
12 #include "Chunks.h"
13 #include "Config.h"
14 #include "DebugTypes.h"
15 #include "InputFiles.h"
16 #include "SymbolTable.h"
17 #include "Writer.h"
18 #include "lld/Common/CommonLinkerContext.h"
19 #include "lld/Common/Timer.h"
21 namespace lld {
22 namespace coff {
24 class COFFLinkerContext : public CommonLinkerContext {
25 public:
26 COFFLinkerContext();
27 COFFLinkerContext(const COFFLinkerContext &) = delete;
28 COFFLinkerContext &operator=(const COFFLinkerContext &) = delete;
29 ~COFFLinkerContext() = default;
31 void addTpiSource(TpiSource *tpi) { tpiSourceList.push_back(tpi); }
33 SymbolTable symtab;
35 std::vector<ObjFile *> objFileInstances;
36 std::map<std::string, PDBInputFile *> pdbInputFileInstances;
37 std::vector<ImportFile *> importFileInstances;
38 std::vector<BitcodeFile *> bitcodeFileInstances;
40 MergeChunk *mergeChunkInstances[Log2MaxSectionAlignment + 1] = {};
42 /// All sources of type information in the program.
43 std::vector<TpiSource *> tpiSourceList;
45 std::map<llvm::codeview::GUID, TpiSource *> typeServerSourceMappings;
46 std::map<uint32_t, TpiSource *> precompSourceMappings;
48 /// List of all output sections. After output sections are finalized, this
49 /// can be indexed by getOutputSection.
50 std::vector<OutputSection *> outputSections;
52 OutputSection *getOutputSection(const Chunk *c) const {
53 return c->osidx == 0 ? nullptr : outputSections[c->osidx - 1];
56 // All timers used in the COFF linker.
57 Timer rootTimer;
58 Timer inputFileTimer;
59 Timer ltoTimer;
60 Timer gcTimer;
61 Timer icfTimer;
63 // Writer timers.
64 Timer codeLayoutTimer;
65 Timer outputCommitTimer;
66 Timer totalMapTimer;
67 Timer symbolGatherTimer;
68 Timer symbolStringsTimer;
69 Timer writeTimer;
71 // PDB timers.
72 Timer totalPdbLinkTimer;
73 Timer addObjectsTimer;
74 Timer typeMergingTimer;
75 Timer loadGHashTimer;
76 Timer mergeGHashTimer;
77 Timer symbolMergingTimer;
78 Timer publicsLayoutTimer;
79 Timer tpiStreamLayoutTimer;
80 Timer diskCommitTimer;
83 } // namespace coff
84 } // namespace lld
86 #endif