Coverage Report

Created: 2019-05-22 02:55

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/COFF/DLL.h
Line
Count
Source
1
//===- DLL.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_DLL_H
10
#define LLD_COFF_DLL_H
11
12
#include "Chunks.h"
13
#include "Symbols.h"
14
15
namespace lld {
16
namespace coff {
17
18
// Windows-specific.
19
// IdataContents creates all chunks for the DLL import table.
20
// You are supposed to call add() to add symbols and then
21
// call create() to populate the chunk vectors.
22
class IdataContents {
23
public:
24
51
  void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
25
277
  bool empty() { return Imports.empty(); }
26
27
  void create();
28
29
  std::vector<DefinedImportData *> Imports;
30
  std::vector<Chunk *> Dirs;
31
  std::vector<Chunk *> Lookups;
32
  std::vector<Chunk *> Addresses;
33
  std::vector<Chunk *> Hints;
34
  std::vector<Chunk *> DLLNames;
35
};
36
37
// Windows-specific.
38
// DelayLoadContents creates all chunks for the delay-load DLL import table.
39
class DelayLoadContents {
40
public:
41
3
  void add(DefinedImportData *Sym) { Imports.push_back(Sym); }
42
307
  bool empty() { return Imports.empty(); }
43
  void create(Defined *Helper);
44
  std::vector<Chunk *> getChunks();
45
  std::vector<Chunk *> getDataChunks();
46
2
  ArrayRef<Chunk *> getCodeChunks() { return Thunks; }
47
48
2
  uint64_t getDirRVA() { return Dirs[0]->getRVA(); }
49
  uint64_t getDirSize();
50
51
private:
52
  Chunk *newThunkChunk(DefinedImportData *S, Chunk *Dir);
53
54
  Defined *Helper;
55
  std::vector<DefinedImportData *> Imports;
56
  std::vector<Chunk *> Dirs;
57
  std::vector<Chunk *> ModuleHandles;
58
  std::vector<Chunk *> Addresses;
59
  std::vector<Chunk *> Names;
60
  std::vector<Chunk *> HintNames;
61
  std::vector<Chunk *> Thunks;
62
  std::vector<Chunk *> DLLNames;
63
};
64
65
// Windows-specific.
66
// EdataContents creates all chunks for the DLL export table.
67
class EdataContents {
68
public:
69
  EdataContents();
70
  std::vector<Chunk *> Chunks;
71
72
116
  uint64_t getRVA() { return Chunks[0]->getRVA(); }
73
58
  uint64_t getSize() {
74
58
    return Chunks.back()->getRVA() + Chunks.back()->getSize() - getRVA();
75
58
  }
76
};
77
78
} // namespace coff
79
} // namespace lld
80
81
#endif