Coverage Report

Created: 2018-08-19 21:11

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/wasm/OutputSegment.h
Line
Count
Source (jump to first uncovered line)
1
//===- OutputSegment.h ------------------------------------------*- C++ -*-===//
2
//
3
//                             The LLVM Linker
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 LLD_WASM_OUTPUT_SEGMENT_H
11
#define LLD_WASM_OUTPUT_SEGMENT_H
12
13
#include "InputChunks.h"
14
#include "lld/Common/ErrorHandler.h"
15
#include "llvm/Object/Wasm.h"
16
17
namespace lld {
18
namespace wasm {
19
20
class InputSegment;
21
22
class OutputSegment {
23
public:
24
0
  OutputSegment(StringRef N, uint32_t Index) : Name(N), Index(Index) {}
25
26
0
  void addInputSegment(InputSegment *InSeg) {
27
0
    Alignment = std::max(Alignment, InSeg->getAlignment());
28
0
    InputSegments.push_back(InSeg);
29
0
    Size = llvm::alignTo(Size, InSeg->getAlignment());
30
0
    InSeg->OutputSeg = this;
31
0
    InSeg->OutputSegmentOffset = Size;
32
0
    Size += InSeg->getSize();
33
0
  }
34
35
  StringRef Name;
36
  const uint32_t Index;
37
  uint32_t SectionOffset = 0;
38
  uint32_t Alignment = 0;
39
  uint32_t StartVA = 0;
40
  std::vector<InputSegment *> InputSegments;
41
42
  // Sum of the size of the all the input segments
43
  uint32_t Size = 0;
44
45
  // Segment header
46
  std::string Header;
47
};
48
49
} // namespace wasm
50
} // namespace lld
51
52
#endif // LLD_WASM_OUTPUT_SEGMENT_H