Coverage Report

Created: 2018-01-17 21:32

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