Coverage Report

Created: 2018-11-16 02:38

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/MC/MCSymbolWasm.h
Line
Count
Source
1
//===- MCSymbolWasm.h -  ----------------------------------------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
#ifndef LLVM_MC_MCSYMBOLWASM_H
10
#define LLVM_MC_MCSYMBOLWASM_H
11
12
#include "llvm/BinaryFormat/Wasm.h"
13
#include "llvm/MC/MCSymbol.h"
14
15
namespace llvm {
16
17
class MCSymbolWasm : public MCSymbol {
18
  wasm::WasmSymbolType Type = wasm::WASM_SYMBOL_TYPE_DATA;
19
  bool IsWeak = false;
20
  bool IsHidden = false;
21
  bool IsComdat = false;
22
  std::string ModuleName;
23
  wasm::WasmSignature *Signature = nullptr;
24
  Optional<wasm::WasmGlobalType> GlobalType;
25
  Optional<wasm::WasmEventType> EventType;
26
27
  /// An expression describing how to calculate the size of a symbol. If a
28
  /// symbol has no size this field will be NULL.
29
  const MCExpr *SymbolSize = nullptr;
30
31
public:
32
  // Use a module name of "env" for now, for compatibility with existing tools.
33
  // This is temporary, and may change, as the ABI is not yet stable.
34
  MCSymbolWasm(const StringMapEntry<bool> *Name, bool isTemporary)
35
19.2k
      : MCSymbol(SymbolKindWasm, Name, isTemporary), ModuleName("env") {}
36
  static bool classof(const MCSymbol *S) { return S->isWasm(); }
37
38
924
  const MCExpr *getSize() const { return SymbolSize; }
39
449
  void setSize(const MCExpr *SS) { SymbolSize = SS; }
40
41
5.01k
  bool isFunction() const { return Type == wasm::WASM_SYMBOL_TYPE_FUNCTION; }
42
1.36k
  bool isData() const { return Type == wasm::WASM_SYMBOL_TYPE_DATA; }
43
678
  bool isGlobal() const { return Type == wasm::WASM_SYMBOL_TYPE_GLOBAL; }
44
977
  bool isSection() const { return Type == wasm::WASM_SYMBOL_TYPE_SECTION; }
45
2.34k
  bool isEvent() const { return Type == wasm::WASM_SYMBOL_TYPE_EVENT; }
46
9.60k
  wasm::WasmSymbolType getType() const { return Type; }
47
11.3k
  void setType(wasm::WasmSymbolType type) { Type = type; }
48
49
573
  bool isWeak() const { return IsWeak; }
50
40
  void setWeak(bool isWeak) { IsWeak = isWeak; }
51
52
563
  bool isHidden() const { return IsHidden; }
53
105
  void setHidden(bool isHidden) { IsHidden = isHidden; }
54
55
2.77k
  bool isComdat() const { return IsComdat; }
56
9
  void setComdat(bool isComdat) { IsComdat = isComdat; }
57
58
387
  const StringRef getModuleName() const { return ModuleName; }
59
1
  void setModuleName(StringRef Name) { ModuleName = Name; }
60
61
1.31k
  const wasm::WasmSignature *getSignature() const { return Signature; }
62
4.25k
  void setSignature(wasm::WasmSignature *Sig) { Signature = Sig; }
63
64
50
  const wasm::WasmGlobalType &getGlobalType() const {
65
50
    assert(GlobalType.hasValue());
66
50
    return GlobalType.getValue();
67
50
  }
68
347
  void setGlobalType(wasm::WasmGlobalType GT) { GlobalType = GT; }
69
70
  const wasm::WasmEventType &getEventType() const {
71
    assert(EventType.hasValue());
72
    return EventType.getValue();
73
  }
74
6
  void setEventType(wasm::WasmEventType ET) { EventType = ET; }
75
};
76
77
} // end namespace llvm
78
79
#endif // LLVM_MC_MCSYMBOLWASM_H