Coverage Report

Created: 2021-04-13 08:44

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Driver/ToolChains/MinGW.h
Line
Count
Source (jump to first uncovered line)
1
//===--- MinGW.h - MinGW ToolChain Implementations --------------*- 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
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
10
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
11
12
#include "Cuda.h"
13
#include "Gnu.h"
14
#include "ROCm.h"
15
#include "clang/Driver/Tool.h"
16
#include "clang/Driver/ToolChain.h"
17
#include "llvm/Support/ErrorOr.h"
18
19
namespace clang {
20
namespace driver {
21
namespace tools {
22
23
/// MinGW -- Directly call GNU Binutils assembler and linker
24
namespace MinGW {
25
class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
26
public:
27
1
  Assembler(const ToolChain &TC) : Tool("MinGW::Assemble", "assembler", TC) {}
28
29
1
  bool hasIntegratedCPP() const override { return false; }
30
31
  void ConstructJob(Compilation &C, const JobAction &JA,
32
                    const InputInfo &Output, const InputInfoList &Inputs,
33
                    const llvm::opt::ArgList &TCArgs,
34
                    const char *LinkingOutput) const override;
35
};
36
37
class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
38
public:
39
59
  Linker(const ToolChain &TC) : Tool("MinGW::Linker", "linker", TC) {}
40
41
59
  bool hasIntegratedCPP() const override { return false; }
42
0
  bool isLinkJob() const override { return true; }
43
44
  void ConstructJob(Compilation &C, const JobAction &JA,
45
                    const InputInfo &Output, const InputInfoList &Inputs,
46
                    const llvm::opt::ArgList &TCArgs,
47
                    const char *LinkingOutput) const override;
48
49
private:
50
  void AddLibGCC(const llvm::opt::ArgList &Args,
51
                 llvm::opt::ArgStringList &CmdArgs) const;
52
};
53
} // end namespace MinGW
54
} // end namespace tools
55
56
namespace toolchains {
57
58
class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain {
59
public:
60
  MinGW(const Driver &D, const llvm::Triple &Triple,
61
        const llvm::opt::ArgList &Args);
62
63
  bool HasNativeLLVMSupport() const override;
64
65
  bool IsIntegratedAssemblerDefault() const override;
66
  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
67
  bool isPICDefault() const override;
68
  bool isPIEDefault() const override;
69
  bool isPICDefaultForced() const override;
70
71
  SanitizerMask getSupportedSanitizers() const override;
72
73
  llvm::ExceptionHandling GetExceptionModel(
74
      const llvm::opt::ArgList &Args) const override;
75
76
  void
77
  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
78
                            llvm::opt::ArgStringList &CC1Args) const override;
79
  void AddClangCXXStdlibIncludeArgs(
80
      const llvm::opt::ArgList &DriverArgs,
81
      llvm::opt::ArgStringList &CC1Args) const override;
82
83
  void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
84
                          llvm::opt::ArgStringList &CC1Args) const override;
85
  void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
86
                         llvm::opt::ArgStringList &CC1Args) const override;
87
88
  void printVerboseInfo(raw_ostream &OS) const override;
89
90
protected:
91
  Tool *getTool(Action::ActionClass AC) const override;
92
  Tool *buildLinker() const override;
93
  Tool *buildAssembler() const override;
94
95
private:
96
  CudaInstallationDetector CudaInstallation;
97
  RocmInstallationDetector RocmInstallation;
98
99
  std::string Base;
100
  std::string GccLibDir;
101
  std::string Ver;
102
  std::string Arch;
103
  mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocessor;
104
  mutable std::unique_ptr<tools::gcc::Compiler> Compiler;
105
  void findGccLibDir();
106
  llvm::ErrorOr<std::string> findGcc();
107
  llvm::ErrorOr<std::string> findClangRelativeSysroot();
108
109
  bool NativeLLVMSupport;
110
};
111
112
} // end namespace toolchains
113
} // end namespace driver
114
} // end namespace clang
115
116
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H