LCOV - code coverage report
Current view: top level - lib/MC - MCValue.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 17 22 77.3 %
Date: 2017-09-14 15:23:50 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- lib/MC/MCValue.cpp - MCValue implementation ------------------------===//
       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             : 
      10             : #include "llvm/MC/MCValue.h"
      11             : #include "llvm/MC/MCExpr.h"
      12             : #include "llvm/Support/Debug.h"
      13             : #include "llvm/Support/ErrorHandling.h"
      14             : #include "llvm/Support/raw_ostream.h"
      15             : 
      16             : using namespace llvm;
      17             : 
      18           1 : void MCValue::print(raw_ostream &OS) const {
      19           1 :   if (isAbsolute()) {
      20           0 :     OS << getConstant();
      21           0 :     return;
      22             :   }
      23             : 
      24             :   // FIXME: prints as a number, which isn't ideal. But the meaning will be
      25             :   // target-specific anyway.
      26           1 :   if (getRefKind())
      27           0 :     OS << ':' << getRefKind() <<  ':';
      28             : 
      29           2 :   OS << *getSymA();
      30             : 
      31           1 :   if (getSymB()) {
      32           1 :     OS << " - ";
      33           1 :     OS << *getSymB();
      34             :   }
      35             : 
      36           1 :   if (getConstant())
      37           0 :     OS << " + " << getConstant();
      38             : }
      39             : 
      40             : #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
      41             : LLVM_DUMP_METHOD void MCValue::dump() const {
      42             :   print(dbgs());
      43             : }
      44             : #endif
      45             : 
      46     1270923 : MCSymbolRefExpr::VariantKind MCValue::getAccessVariant() const {
      47     1270923 :   const MCSymbolRefExpr *B = getSymB();
      48     1270923 :   if (B) {
      49        9232 :     if (B->getKind() != MCSymbolRefExpr::VK_None)
      50           0 :       llvm_unreachable("unsupported");
      51             :   }
      52             : 
      53     1270923 :   const MCSymbolRefExpr *A = getSymA();
      54     1270923 :   if (!A)
      55             :     return MCSymbolRefExpr::VK_None;
      56             : 
      57     1270915 :   MCSymbolRefExpr::VariantKind Kind = A->getKind();
      58     1270915 :   if (Kind == MCSymbolRefExpr::VK_WEAKREF)
      59             :     return MCSymbolRefExpr::VK_None;
      60     1270915 :   return Kind;
      61             : }

Generated by: LCOV version 1.13