Coverage Report

Created: 2019-05-19 14:56

/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
54
  OutputSegment(StringRef N, uint32_t Index) : Name(N), Index(Index) {}
24
25
95
  void addInputSegment(InputSegment *InSeg) {
26
95
    Alignment = std::max(Alignment, InSeg->getAlignment());
27
95
    InputSegments.push_back(InSeg);
28
95
    Size = llvm::alignTo(Size, 1ULL << InSeg->getAlignment());
29
95
    InSeg->OutputSeg = this;
30
95
    InSeg->OutputSegmentOffset = Size;
31
95
    Size += InSeg->getSize();
32
95
  }
33
34
  StringRef Name;
35
  const uint32_t Index;
36
  uint32_t SectionOffset = 0;
37
  uint32_t Alignment = 0;
38
  uint32_t StartVA = 0;
39
  std::vector<InputSegment *> InputSegments;
40
41
  // Sum of the size of the all the input segments
42
  uint32_t Size = 0;
43
44
  // Segment header
45
  std::string Header;
46
};
47
48
} // namespace wasm
49
} // namespace lld
50
51
#endif // LLD_WASM_OUTPUT_SEGMENT_H