LCOV - code coverage report
Current view: top level - include/llvm/Analysis - ObjectUtils.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 5 5 100.0 %
Date: 2017-09-14 15:23:50 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- Analysis/ObjectUtils.h - analysis utils for object files -*- 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             : 
      10             : #ifndef LLVM_ANALYSIS_OBJECT_UTILS_H
      11             : #define LLVM_ANALYSIS_OBJECT_UTILS_H
      12             : 
      13             : #include "llvm/IR/GlobalVariable.h"
      14             : 
      15             : namespace llvm {
      16             : 
      17             : /// True if GV can be left out of the object symbol table. This is the case
      18             : /// for linkonce_odr values whose address is not significant. While legal, it is
      19             : /// not normally profitable to omit them from the .o symbol table. Using this
      20             : /// analysis makes sense when the information can be passed down to the linker
      21             : /// or we are in LTO.
      22             : inline bool canBeOmittedFromSymbolTable(const GlobalValue *GV) {
      23        8311 :   if (!GV->hasLinkOnceODRLinkage())
      24             :     return false;
      25             : 
      26             :   // We assume that anyone who sets global unnamed_addr on a non-constant knows
      27             :   // what they're doing.
      28         429 :   if (GV->hasGlobalUnnamedAddr())
      29             :     return true;
      30             : 
      31             :   // If it is a non constant variable, it needs to be uniqued across shared
      32             :   // objects.
      33          33 :   if (auto *Var = dyn_cast<GlobalVariable>(GV))
      34          33 :     if (!Var->isConstant())
      35             :       return false;
      36             : 
      37         197 :   return GV->hasAtLeastLocalUnnamedAddr();
      38             : }
      39             : 
      40             : }
      41             : 
      42             : #endif

Generated by: LCOV version 1.13