clang  10.0.0svn
MinGW.h
Go to the documentation of this file.
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 "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
16 
17 namespace clang {
18 namespace driver {
19 namespace tools {
20 
21 /// MinGW -- Directly call GNU Binutils assembler and linker
22 namespace MinGW {
23 class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
24 public:
25  Assembler(const ToolChain &TC) : Tool("MinGW::Assemble", "assembler", TC) {}
26 
27  bool hasIntegratedCPP() const override { return false; }
28 
29  void ConstructJob(Compilation &C, const JobAction &JA,
30  const InputInfo &Output, const InputInfoList &Inputs,
31  const llvm::opt::ArgList &TCArgs,
32  const char *LinkingOutput) const override;
33 };
34 
35 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
36 public:
37  Linker(const ToolChain &TC)
38  : Tool("MinGW::Linker", "linker", TC, Tool::RF_Full) {}
39 
40  bool hasIntegratedCPP() const override { return false; }
41  bool isLinkJob() const override { return true; }
42 
43  void ConstructJob(Compilation &C, const JobAction &JA,
44  const InputInfo &Output, const InputInfoList &Inputs,
45  const llvm::opt::ArgList &TCArgs,
46  const char *LinkingOutput) const override;
47 
48 private:
49  void AddLibGCC(const llvm::opt::ArgList &Args,
50  llvm::opt::ArgStringList &CmdArgs) const;
51 };
52 } // end namespace MinGW
53 } // end namespace tools
54 
55 namespace toolchains {
56 
57 class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain {
58 public:
59  MinGW(const Driver &D, const llvm::Triple &Triple,
60  const llvm::opt::ArgList &Args);
61 
62  bool HasNativeLLVMSupport() const override;
63 
64  bool IsIntegratedAssemblerDefault() const override;
65  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
66  bool isPICDefault() const override;
67  bool isPIEDefault() const override;
68  bool isPICDefaultForced() const override;
69 
70  SanitizerMask getSupportedSanitizers() const override;
71 
72  llvm::ExceptionHandling GetExceptionModel(
73  const llvm::opt::ArgList &Args) const override;
74 
75  void
76  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
77  llvm::opt::ArgStringList &CC1Args) const override;
78  void AddClangCXXStdlibIncludeArgs(
79  const llvm::opt::ArgList &DriverArgs,
80  llvm::opt::ArgStringList &CC1Args) const override;
81 
82  void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
83  llvm::opt::ArgStringList &CC1Args) const override;
84 
85  void printVerboseInfo(raw_ostream &OS) const override;
86 
87 protected:
88  Tool *getTool(Action::ActionClass AC) const override;
89  Tool *buildLinker() const override;
90  Tool *buildAssembler() const override;
91 
92 private:
93  CudaInstallationDetector CudaInstallation;
94 
95  std::string Base;
96  std::string GccLibDir;
97  std::string Ver;
98  std::string Arch;
99  mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocessor;
100  mutable std::unique_ptr<tools::gcc::Compiler> Compiler;
101  void findGccLibDir();
102  llvm::ErrorOr<std::string> findGcc();
103  llvm::ErrorOr<std::string> findClangRelativeSysroot();
104 
105  bool NativeLLVMSupport;
106 };
107 
108 } // end namespace toolchains
109 } // end namespace driver
110 } // end namespace clang
111 
112 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
A class to find a viable CUDA installation.
Definition: Cuda.h:28
bool hasIntegratedCPP() const override
Definition: MinGW.h:27
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
Assembler(const ToolChain &TC)
Definition: MinGW.h:25
bool isLinkJob() const override
Definition: MinGW.h:41
Dataflow Directional Tag Classes.
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Linker(const ToolChain &TC)
Definition: MinGW.h:37
bool hasIntegratedCPP() const override
Definition: MinGW.h:40
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:125
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88