clang  6.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 IsIntegratedAssemblerDefault() const override;
63  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
64  bool isPICDefault() const override;
65  bool isPIEDefault() const override;
66  bool isPICDefaultForced() const override;
67 
68  llvm::ExceptionHandling GetExceptionModel(
69  const llvm::opt::ArgList &Args) const override;
70 
71  void
72  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
73  llvm::opt::ArgStringList &CC1Args) const override;
74  void AddClangCXXStdlibIncludeArgs(
75  const llvm::opt::ArgList &DriverArgs,
76  llvm::opt::ArgStringList &CC1Args) const override;
77 
78  void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
79  llvm::opt::ArgStringList &CC1Args) const override;
80 
81  void printVerboseInfo(raw_ostream &OS) const override;
82 
83 protected:
84  Tool *getTool(Action::ActionClass AC) const override;
85  Tool *buildLinker() const override;
86  Tool *buildAssembler() const override;
87 
88 private:
89  CudaInstallationDetector CudaInstallation;
90 
91  std::string Base;
92  std::string GccLibDir;
93  std::string Ver;
94  std::string Arch;
95  mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocessor;
96  mutable std::unique_ptr<tools::gcc::Compiler> Compiler;
97  void findGccLibDir();
98  llvm::ErrorOr<std::string> findGcc();
99 };
100 
101 } // end namespace toolchains
102 } // end namespace driver
103 } // end namespace clang
104 
105 #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:65
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
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:34
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:73