LCOV - code coverage report
Current view: top level - include/llvm/MC - MCSymbolWasm.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 12 23 52.2 %
Date: 2018-10-20 13:21:21 Functions: 2 16 12.5 %
Legend: Lines: hit not hit

          Line data    Source code
       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             :   wasm::WasmGlobalType GlobalType;
      25             :   bool GlobalTypeSet = false;
      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       16679 :   MCSymbolWasm(const StringMapEntry<bool> *Name, bool isTemporary)
      35       32726 :       : MCSymbol(SymbolKindWasm, Name, isTemporary), ModuleName("env") {}
      36             :   static bool classof(const MCSymbol *S) { return S->isWasm(); }
      37             : 
      38           0 :   const MCExpr *getSize() const { return SymbolSize; }
      39         442 :   void setSize(const MCExpr *SS) { SymbolSize = SS; }
      40             : 
      41         436 :   bool isFunction() const { return Type == wasm::WASM_SYMBOL_TYPE_FUNCTION; }
      42           0 :   bool isData() const { return Type == wasm::WASM_SYMBOL_TYPE_DATA; }
      43           0 :   bool isGlobal() const { return Type == wasm::WASM_SYMBOL_TYPE_GLOBAL; }
      44           0 :   bool isSection() const { return Type == wasm::WASM_SYMBOL_TYPE_SECTION; }
      45           0 :   wasm::WasmSymbolType getType() const { return Type; }
      46       10015 :   void setType(wasm::WasmSymbolType type) { Type = type; }
      47             : 
      48           0 :   bool isWeak() const { return IsWeak; }
      49          34 :   void setWeak(bool isWeak) { IsWeak = isWeak; }
      50             : 
      51           0 :   bool isHidden() const { return IsHidden; }
      52         104 :   void setHidden(bool isHidden) { IsHidden = isHidden; }
      53             : 
      54           0 :   bool isComdat() const { return IsComdat; }
      55           9 :   void setComdat(bool isComdat) { IsComdat = isComdat; }
      56             : 
      57             :   const StringRef getModuleName() const { return ModuleName; }
      58           2 :   void setModuleName(StringRef Name) { ModuleName = Name; }
      59             : 
      60           0 :   const wasm::WasmSignature *getSignature() const { return Signature; }
      61        3637 :   void setSignature(wasm::WasmSignature *Sig) { Signature = Sig; }
      62             : 
      63             :   const wasm::WasmGlobalType &getGlobalType() const {
      64             :     assert(GlobalTypeSet);
      65             :     return GlobalType;
      66             :   }
      67             : 
      68           0 :   void setGlobalType(wasm::WasmGlobalType GT) {
      69         254 :     GlobalTypeSet = true;
      70         254 :     GlobalType = GT;
      71           0 :   }
      72             : };
      73             : 
      74             : } // end namespace llvm
      75             : 
      76             : #endif // LLVM_MC_MCSYMBOLWASM_H

Generated by: LCOV version 1.13