Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/LinkAllIR.h
Line
Count
Source (jump to first uncovered line)
1
//===----- LinkAllIR.h - Reference All VMCore Code --------------*- 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
// This header file pulls in all the object modules of the VMCore library so
11
// that tools like llc, opt, and lli can ensure they are linked with all symbols
12
// from libVMCore.a It should only be used from a tool's main program.
13
//
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_LINKALLIR_H
17
#define LLVM_LINKALLIR_H
18
19
#include "llvm/BinaryFormat/Dwarf.h"
20
#include "llvm/IR/InlineAsm.h"
21
#include "llvm/IR/Instructions.h"
22
#include "llvm/IR/LLVMContext.h"
23
#include "llvm/IR/Module.h"
24
#include "llvm/IR/Verifier.h"
25
#include "llvm/Support/DynamicLibrary.h"
26
#include "llvm/Support/MathExtras.h"
27
#include "llvm/Support/Memory.h"
28
#include "llvm/Support/Mutex.h"
29
#include "llvm/Support/Path.h"
30
#include "llvm/Support/Process.h"
31
#include "llvm/Support/Program.h"
32
#include "llvm/Support/Signals.h"
33
#include <cstdlib>
34
35
namespace {
36
  struct ForceVMCoreLinking {
37
7.90k
    ForceVMCoreLinking() {
38
7.90k
      // We must reference VMCore in such a way that compilers will not
39
7.90k
      // delete it all as dead code, even with whole program optimization,
40
7.90k
      // yet is effectively a NO-OP. As the compiler isn't smart enough
41
7.90k
      // to know that getenv() never returns -1, this will do the job.
42
7.90k
      if (std::getenv("bar") != (char*) -1)
43
7.90k
        return;
44
0
      llvm::LLVMContext Context;
45
0
      (void)new llvm::Module("", Context);
46
0
      (void)new llvm::UnreachableInst(Context);
47
0
      (void)    llvm::createVerifierPass(); 
48
0
    }
49
  } ForceVMCoreLinking;
50
}
51
52
#endif