clang  8.0.0svn
MinGW.h
Go to the documentation of this file.
1 //===--- MinGW.h - MinGW ToolChain Implementations --------------*- 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_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
12 
13 #include "Cuda.h"
14 #include "Gnu.h"
15 #include "clang/Driver/Tool.h"
16 #include "clang/Driver/ToolChain.h"
17 
18 namespace clang {
19 namespace driver {
20 namespace tools {
21 
22 /// MinGW -- Directly call GNU Binutils assembler and linker
23 namespace MinGW {
24 class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
25 public:
26  Assembler(const ToolChain &TC) : Tool("MinGW::Assemble", "assembler", TC) {}
27 
28  bool hasIntegratedCPP() const override { return false; }
29 
30  void ConstructJob(Compilation &C, const JobAction &JA,
31  const InputInfo &Output, const InputInfoList &Inputs,
32  const llvm::opt::ArgList &TCArgs,
33  const char *LinkingOutput) const override;
34 };
35 
36 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
37 public:
38  Linker(const ToolChain &TC) : Tool("MinGW::Linker", "linker", TC) {}
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:29
bool hasIntegratedCPP() const override
Definition: MinGW.h:28
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:23
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:58
Assembler(const ToolChain &TC)
Definition: MinGW.h:26
bool isLinkJob() const override
Definition: MinGW.h:41
Dataflow Directional Tag Classes.
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
uint64_t SanitizerMask
Definition: Sanitizers.h:26
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:46
Linker(const ToolChain &TC)
Definition: MinGW.h:38
bool hasIntegratedCPP() const override
Definition: MinGW.h:40
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:127
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:87