Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/wasm/OutputSegment.h
Line
Count
Source
1
//===- OutputSegment.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_WASM_OUTPUT_SEGMENT_H
10
#define LLD_WASM_OUTPUT_SEGMENT_H
11
12
#include "InputChunks.h"
13
#include "lld/Common/ErrorHandler.h"
14
#include "llvm/Object/Wasm.h"
15
16
namespace lld {
17
namespace wasm {
18
19
class InputSegment;
20
21
class OutputSegment {
22
public:
23
102
  OutputSegment(StringRef n, uint32_t index) : name(n), index(index) {}
24
25
174
  void addInputSegment(InputSegment *inSeg) {
26
174
    alignment = std::max(alignment, inSeg->getAlignment());
27
174
    inputSegments.push_back(inSeg);
28
174
    size = llvm::alignTo(size, 1ULL << inSeg->getAlignment());
29
174
    inSeg->outputSeg = this;
30
174
    inSeg->outputSegmentOffset = size;
31
174
    size += inSeg->getSize();
32
174
  }
33
34
  StringRef name;
35
  const uint32_t index;
36
  uint32_t initFlags = 0;
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