Coverage Report

Created: 2019-07-24 05:18

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