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

          Line data    Source code
       1             : //===- lib/MC/MCObjectWriter.cpp - MCObjectWriter 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/MCObjectWriter.h"
      11             : #include "llvm/MC/MCAssembler.h"
      12             : #include "llvm/MC/MCExpr.h"
      13             : #include "llvm/MC/MCFragment.h"
      14             : #include "llvm/MC/MCSymbol.h"
      15             : 
      16             : using namespace llvm;
      17             : 
      18             : MCObjectWriter::~MCObjectWriter() = default;
      19             : 
      20      962965 : bool MCObjectWriter::isSymbolRefDifferenceFullyResolved(
      21             :     const MCAssembler &Asm, const MCSymbolRefExpr *A, const MCSymbolRefExpr *B,
      22             :     bool InSet) const {
      23             :   // Modified symbol references cannot be resolved.
      24     1925912 :   if (A->getKind() != MCSymbolRefExpr::VK_None ||
      25      962947 :       B->getKind() != MCSymbolRefExpr::VK_None)
      26             :     return false;
      27             : 
      28      962947 :   const MCSymbol &SA = A->getSymbol();
      29      962947 :   const MCSymbol &SB = B->getSymbol();
      30     1925894 :   if (SA.isUndefined() || SB.isUndefined())
      31             :     return false;
      32             : 
      33      962947 :   if (!SA.getFragment() || !SB.getFragment())
      34             :     return false;
      35             : 
      36      962947 :   return isSymbolRefDifferenceFullyResolvedImpl(Asm, SA, SB, InSet);
      37             : }
      38             : 
      39      962944 : bool MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
      40             :     const MCAssembler &Asm, const MCSymbol &A, const MCSymbol &B,
      41             :     bool InSet) const {
      42      962944 :   return isSymbolRefDifferenceFullyResolvedImpl(Asm, A, *B.getFragment(), InSet,
      43     1925888 :                                                 false);
      44             : }
      45             : 
      46     1405190 : bool MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
      47             :     const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB,
      48             :     bool InSet, bool IsPCRel) const {
      49     1405189 :   const MCSection &SecA = SymA.getSection();
      50     1405189 :   const MCSection &SecB = *FB.getParent();
      51             :   // On ELF and COFF  A - B is absolute if A and B are in the same section.
      52     1405189 :   return &SecA == &SecB;
      53             : }

Generated by: LCOV version 1.13