1 //===--- MinGW.h - MinGW ToolChain Implementations --------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
15 #include "clang/Driver/Tool.h"
16 #include "clang/Driver/ToolChain.h"
17 #include "llvm/Support/ErrorOr.h"
23 /// MinGW -- Directly call GNU Binutils assembler and linker
25 class LLVM_LIBRARY_VISIBILITY Assembler
: public Tool
{
27 Assembler(const ToolChain
&TC
) : Tool("MinGW::Assemble", "assembler", TC
) {}
29 bool hasIntegratedCPP() const override
{ return false; }
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
;
37 class LLVM_LIBRARY_VISIBILITY Linker
: public Tool
{
39 Linker(const ToolChain
&TC
) : Tool("MinGW::Linker", "linker", TC
) {}
41 bool hasIntegratedCPP() const override
{ return false; }
42 bool isLinkJob() const override
{ return true; }
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
;
50 void AddLibGCC(const llvm::opt::ArgList
&Args
,
51 llvm::opt::ArgStringList
&CmdArgs
) const;
53 } // end namespace MinGW
54 } // end namespace tools
56 namespace toolchains
{
58 class LLVM_LIBRARY_VISIBILITY MinGW
: public ToolChain
{
60 MinGW(const Driver
&D
, const llvm::Triple
&Triple
,
61 const llvm::opt::ArgList
&Args
);
63 static void fixTripleArch(const Driver
&D
, llvm::Triple
&Triple
,
64 const llvm::opt::ArgList
&Args
);
66 bool HasNativeLLVMSupport() const override
;
68 bool IsIntegratedAssemblerDefault() const override
;
69 bool IsUnwindTablesDefault(const llvm::opt::ArgList
&Args
) const override
;
70 bool isPICDefault() const override
;
71 bool isPIEDefault(const llvm::opt::ArgList
&Args
) const override
;
72 bool isPICDefaultForced() const override
;
74 SanitizerMask
getSupportedSanitizers() const override
;
76 llvm::ExceptionHandling
GetExceptionModel(
77 const llvm::opt::ArgList
&Args
) const override
;
80 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
81 llvm::opt::ArgStringList
&CC1Args
) const override
;
83 addClangTargetOptions(const llvm::opt::ArgList
&DriverArgs
,
84 llvm::opt::ArgStringList
&CC1Args
,
85 Action::OffloadKind DeviceOffloadKind
) const override
;
86 void AddClangCXXStdlibIncludeArgs(
87 const llvm::opt::ArgList
&DriverArgs
,
88 llvm::opt::ArgStringList
&CC1Args
) const override
;
90 void AddCudaIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
91 llvm::opt::ArgStringList
&CC1Args
) const override
;
92 void AddHIPIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
93 llvm::opt::ArgStringList
&CC1Args
) const override
;
95 void printVerboseInfo(raw_ostream
&OS
) const override
;
97 unsigned GetDefaultDwarfVersion() const override
{ return 4; }
100 Tool
*getTool(Action::ActionClass AC
) const override
;
101 Tool
*buildLinker() const override
;
102 Tool
*buildAssembler() const override
;
105 CudaInstallationDetector CudaInstallation
;
106 RocmInstallationDetector RocmInstallation
;
109 std::string GccLibDir
;
110 clang::driver::toolchains::Generic_GCC::GCCVersion GccVer
;
112 std::string SubdirName
;
113 mutable std::unique_ptr
<tools::gcc::Preprocessor
> Preprocessor
;
114 mutable std::unique_ptr
<tools::gcc::Compiler
> Compiler
;
115 void findGccLibDir();
117 bool NativeLLVMSupport
;
120 } // end namespace toolchains
121 } // end namespace driver
122 } // end namespace clang
124 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H