10#include "llvm/Support/VirtualFileSystem.h"
19 const Driver &D,
const llvm::Triple &HostTriple,
20 const llvm::opt::ArgList &Args)
24 StringRef SysRoot = D.SysRoot;
27 if (HostTriple.isWindowsMSVCEnvironment() ||
28 HostTriple.isWindowsItaniumEnvironment()) {
33 if (DriverDir.starts_with(SysRoot) &&
34 Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
false)) {
36 llvm::sys::path::append(LibDir,
"..",
"lib");
40 llvm::sys::path::append(SYCLLibPath,
"LLVMSYCL.lib");
42 if (D.getVFS().exists(SYCLLibPath))
43 SYCLRTLibPath = LibDir;
48 llvm::sys::path::append(LibPath,
"..",
"lib", HostTriple.str(),
53 llvm::sys::path::append(FlatLibPath,
"..",
"lib",
"libLLVMSYCL.so");
55 if (DriverDir.starts_with(SysRoot) &&
56 Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
false)) {
58 if (D.getVFS().exists(LibPath))
59 llvm::sys::path::append(DriverDir,
"..",
"lib", HostTriple.str());
61 else if (D.getVFS().exists(FlatLibPath))
62 llvm::sys::path::append(DriverDir,
"..",
"lib");
67 SYCLRTLibPath = DriverDir;
73 const ArgList &DriverArgs, ArgStringList &CC1Args)
const {
74 if (DriverArgs.hasArg(options::OPT_nobuiltininc))
80 llvm::sys::path::append(IncludePath,
"..",
"include");
81 CC1Args.push_back(
"-internal-isystem");
82 CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));
88 options::OPT_fsanitize_EQ,
89 options::OPT_fcf_protection_EQ,
90 options::OPT_fprofile_generate,
91 options::OPT_fprofile_generate_EQ,
92 options::OPT_fno_profile_generate,
93 options::OPT_ftest_coverage,
94 options::OPT_fno_test_coverage,
95 options::OPT_fcoverage_mapping,
96 options::OPT_fno_coverage_mapping,
97 options::OPT_coverage,
98 options::OPT_fprofile_instr_generate,
99 options::OPT_fprofile_instr_generate_EQ,
100 options::OPT_fno_profile_instr_generate,
101 options::OPT_fprofile_arcs,
102 options::OPT_fno_profile_arcs,
103 options::OPT_fcreate_profile,
104 options::OPT_fprofile_instr_use,
105 options::OPT_fprofile_instr_use_EQ,
106 options::OPT_fcs_profile_generate,
107 options::OPT_fcs_profile_generate_EQ,
109 return UnsupportedOpts;
113 const ToolChain &HostTC,
const ArgList &Args)
114 :
ToolChain(D, Triple, Args), HostTC(HostTC),
115 SYCLInstallation(D, Triple, Args) {
122 if (
const Arg *A = Args.getLastArg(Opt)) {
123 D.Diag(clang::diag::warn_drv_unsupported_option_for_target)
124 << A->getAsString(Args) <<
getTriple().str();
130 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
132 HostTC.addClangTargetOptions(DriverArgs, CC1Args, BoundArch,
133 DeviceOffloadingKind);
136llvm::opt::DerivedArgList *
140 DerivedArgList *DAL =
141 HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
143 bool IsNewDAL =
false;
145 DAL =
new DerivedArgList(Args.getBaseArgs());
149 for (Arg *A : Args) {
152 auto Opt(A->getOption());
153 bool Unsupported =
false;
155 if (Opt.matches(UnsupportedOpt)) {
156 if (Opt.getID() == options::OPT_fsanitize_EQ &&
157 A->getValues().size() == 1) {
158 std::string SanitizeVal = A->getValue();
159 if (SanitizeVal ==
"address") {
166 DAL->eraseArg(Opt.getID());
177 if (!BoundArch.empty()) {
178 DAL->eraseArg(options::OPT_march_EQ);
179 DAL->AddJoinedArg(
nullptr, Opts.getOption(options::OPT_march_EQ),
186 HostTC.addClangWarningOptions(CC1Args);
191 return HostTC.GetCXXStdlibType(Args);
195 ArgStringList &CC1Args)
const {
196 SYCLInstallation.addSYCLIncludeArgs(DriverArgs, CC1Args);
200 ArgStringList &CC1Args)
const {
201 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
205 ArgStringList &CC1Args)
const {
206 HostTC.AddClangCXXStdlibIncludeArgs(Args, CC1Args);
static ArrayRef< options::ID > getUnsupportedOpts()
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
const llvm::opt::OptTable & getOpts() const
SYCLInstallationDetector(const Driver &D, const llvm::Triple &HostTriple, const llvm::opt::ArgList &Args)
void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
The JSON file list parser is used to communicate input to InstallAPI.