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 llvm::sys::path::append(LibPath,
"..",
"lib", HostTriple.str(),
32 llvm::sys::path::append(FlatLibPath,
"..",
"lib",
"libLLVMSYCL.so");
34 if (DriverDir.starts_with(SysRoot) &&
35 Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl,
false)) {
37 if (D.getVFS().exists(LibPath))
38 llvm::sys::path::append(DriverDir,
"..",
"lib", HostTriple.str());
40 else if (D.getVFS().exists(FlatLibPath))
41 llvm::sys::path::append(DriverDir,
"..",
"lib");
44 SYCLRTLibPath = DriverDir;
49 const ArgList &DriverArgs, ArgStringList &CC1Args)
const {
50 if (DriverArgs.hasArg(options::OPT_nobuiltininc))
56 llvm::sys::path::append(IncludePath,
"..",
"include");
57 CC1Args.push_back(
"-internal-isystem");
58 CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));
64 options::OPT_fsanitize_EQ,
65 options::OPT_fcf_protection_EQ,
66 options::OPT_fprofile_generate,
67 options::OPT_fprofile_generate_EQ,
68 options::OPT_fno_profile_generate,
69 options::OPT_ftest_coverage,
70 options::OPT_fno_test_coverage,
71 options::OPT_fcoverage_mapping,
72 options::OPT_fno_coverage_mapping,
73 options::OPT_coverage,
74 options::OPT_fprofile_instr_generate,
75 options::OPT_fprofile_instr_generate_EQ,
76 options::OPT_fno_profile_instr_generate,
77 options::OPT_fprofile_arcs,
78 options::OPT_fno_profile_arcs,
79 options::OPT_fcreate_profile,
80 options::OPT_fprofile_instr_use,
81 options::OPT_fprofile_instr_use_EQ,
82 options::OPT_fcs_profile_generate,
83 options::OPT_fcs_profile_generate_EQ,
85 return UnsupportedOpts;
89 const ToolChain &HostTC,
const ArgList &Args)
90 :
ToolChain(D, Triple, Args), HostTC(HostTC),
91 SYCLInstallation(D, Triple, Args) {
98 if (
const Arg *A = Args.getLastArg(Opt)) {
99 D.Diag(clang::diag::warn_drv_unsupported_option_for_target)
100 << A->getAsString(Args) <<
getTriple().str();
106 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
108 HostTC.addClangTargetOptions(DriverArgs, CC1Args, DeviceOffloadingKind);
111llvm::opt::DerivedArgList *
115 DerivedArgList *DAL =
116 HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
118 bool IsNewDAL =
false;
120 DAL =
new DerivedArgList(Args.getBaseArgs());
124 for (Arg *A : Args) {
127 auto Opt(A->getOption());
128 bool Unsupported =
false;
130 if (Opt.matches(UnsupportedOpt)) {
131 if (Opt.getID() == options::OPT_fsanitize_EQ &&
132 A->getValues().size() == 1) {
133 std::string SanitizeVal = A->getValue();
134 if (SanitizeVal ==
"address") {
141 DAL->eraseArg(Opt.getID());
152 if (!BoundArch.empty()) {
153 DAL->eraseArg(options::OPT_march_EQ);
154 DAL->AddJoinedArg(
nullptr, Opts.getOption(options::OPT_march_EQ),
161 HostTC.addClangWarningOptions(CC1Args);
166 return HostTC.GetCXXStdlibType(Args);
170 ArgStringList &CC1Args)
const {
171 SYCLInstallation.addSYCLIncludeArgs(DriverArgs, CC1Args);
175 ArgStringList &CC1Args)
const {
176 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
180 ArgStringList &CC1Args)
const {
181 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.