clang 22.0.0git
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"
17#include "clang/Driver/Tool.h"
19#include "llvm/Support/ErrorOr.h"
20
21namespace clang {
22namespace driver {
23namespace tools {
24
25/// Directly call GNU Binutils assembler and linker
26namespace MinGW {
27class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
28public:
29 Assembler(const ToolChain &TC) : Tool("MinGW::Assemble", "assembler", TC) {}
30
31 bool hasIntegratedCPP() const override { return false; }
32
33 void ConstructJob(Compilation &C, const JobAction &JA,
34 const InputInfo &Output, const InputInfoList &Inputs,
35 const llvm::opt::ArgList &TCArgs,
36 const char *LinkingOutput) const override;
37};
38
39class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
40public:
41 Linker(const ToolChain &TC) : Tool("MinGW::Linker", "linker", TC) {}
42
43 bool hasIntegratedCPP() const override { return false; }
44 bool isLinkJob() const override { return true; }
45
46 void ConstructJob(Compilation &C, const JobAction &JA,
47 const InputInfo &Output, const InputInfoList &Inputs,
48 const llvm::opt::ArgList &TCArgs,
49 const char *LinkingOutput) const override;
50
51private:
52 void AddLibGCC(const llvm::opt::ArgList &Args,
53 llvm::opt::ArgStringList &CmdArgs) const;
54};
55} // end namespace MinGW
56} // end namespace tools
57
58namespace toolchains {
59
60class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain {
61public:
62 MinGW(const Driver &D, const llvm::Triple &Triple,
63 const llvm::opt::ArgList &Args);
64
65 static void fixTripleArch(const Driver &D, llvm::Triple &Triple,
66 const llvm::opt::ArgList &Args);
67
68 bool HasNativeLLVMSupport() const override;
69
71 getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override;
72 bool isPICDefault() const override;
73 bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
74 bool isPICDefaultForced() const override;
75
76 SanitizerMask getSupportedSanitizers() const override;
77
78 llvm::ExceptionHandling GetExceptionModel(
79 const llvm::opt::ArgList &Args) const override;
80
81 void
82 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
83 llvm::opt::ArgStringList &CC1Args) const override;
84 void
85 addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
86 llvm::opt::ArgStringList &CC1Args,
87 Action::OffloadKind DeviceOffloadKind) const override;
88 void AddClangCXXStdlibIncludeArgs(
89 const llvm::opt::ArgList &DriverArgs,
90 llvm::opt::ArgStringList &CC1Args) const override;
91
92 void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
93 llvm::opt::ArgStringList &CC1Args) const override;
94 void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
95 llvm::opt::ArgStringList &CC1Args) const override;
96
97 void printVerboseInfo(raw_ostream &OS) const override;
98
99 unsigned GetDefaultDwarfVersion() const override { return 4; }
100
101protected:
102 Tool *getTool(Action::ActionClass AC) const override;
103 Tool *buildLinker() const override;
104 Tool *buildAssembler() const override;
105
106private:
109
110 std::string Base;
111 std::string GccLibDir;
113 std::string Ver;
114 std::string SubdirName;
115 std::string TripleDirName;
116 mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocessor;
117 mutable std::unique_ptr<tools::gcc::Compiler> Compiler;
118 void findGccLibDir(const llvm::Triple &LiteralTriple);
119
120 bool NativeLLVMSupport;
121};
122
123} // end namespace toolchains
124} // end namespace driver
125} // end namespace clang
126
127#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINGW_H
const Decl * D
Simple wrapper for toolchain detector with costly initialization.
Definition: LazyDetector.h:21
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:145
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:99
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
unsigned GetDefaultDwarfVersion() const override
Definition: MinGW.h:99
bool hasIntegratedCPP() const override
Definition: MinGW.h:31
Assembler(const ToolChain &TC)
Definition: MinGW.h:29
bool hasIntegratedCPP() const override
Definition: MinGW.h:43
bool isLinkJob() const override
Definition: MinGW.h:44
Linker(const ToolChain &TC)
Definition: MinGW.h:41
The JSON file list parser is used to communicate input to InstallAPI.
Struct to store and manipulate GCC versions.
Definition: Gnu.h:163