10#include "llvm/Support/VirtualFileSystem.h"
19 const Driver &D,
const llvm::Triple &HostTriple,
20 const llvm::opt::ArgList &Args)
25 StringRef SysRoot = D.SysRoot;
27 if (DriverDir.starts_with(SysRoot) &&
28 (Args.hasArg(options::OPT_fsycl) ||
29 D.getVFS().exists(DriverDir +
"/../lib/libsycl.so"))) {
30 llvm::sys::path::append(DriverDir,
"..",
"lib");
31 SYCLRTLibPath = DriverDir;
36 const ArgList &DriverArgs, ArgStringList &CC1Args)
const {
37 if (DriverArgs.hasArg(options::OPT_nobuiltininc))
43 llvm::sys::path::append(IncludePath,
"..",
"include");
44 CC1Args.push_back(
"-internal-isystem");
45 CC1Args.push_back(DriverArgs.MakeArgString(IncludePath));
51 options::OPT_fsanitize_EQ,
52 options::OPT_fcf_protection_EQ,
53 options::OPT_fprofile_generate,
54 options::OPT_fprofile_generate_EQ,
55 options::OPT_fno_profile_generate,
56 options::OPT_ftest_coverage,
57 options::OPT_fno_test_coverage,
58 options::OPT_fcoverage_mapping,
59 options::OPT_fno_coverage_mapping,
60 options::OPT_coverage,
61 options::OPT_fprofile_instr_generate,
62 options::OPT_fprofile_instr_generate_EQ,
63 options::OPT_fno_profile_instr_generate,
64 options::OPT_fprofile_arcs,
65 options::OPT_fno_profile_arcs,
66 options::OPT_fcreate_profile,
67 options::OPT_fprofile_instr_use,
68 options::OPT_fprofile_instr_use_EQ,
69 options::OPT_fcs_profile_generate,
70 options::OPT_fcs_profile_generate_EQ,
72 return UnsupportedOpts;
76 const ToolChain &HostTC,
const ArgList &Args)
77 :
ToolChain(D, Triple, Args), HostTC(HostTC),
78 SYCLInstallation(D, Triple, Args) {
85 if (
const Arg *A = Args.getLastArg(Opt)) {
86 D.Diag(clang::diag::warn_drv_unsupported_option_for_target)
87 << A->getAsString(Args) <<
getTriple().str();
93 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
95 HostTC.addClangTargetOptions(DriverArgs, CC1Args, DeviceOffloadingKind);
98llvm::opt::DerivedArgList *
102 DerivedArgList *DAL =
103 HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
105 bool IsNewDAL =
false;
107 DAL =
new DerivedArgList(Args.getBaseArgs());
111 for (Arg *A : Args) {
114 auto Opt(A->getOption());
115 bool Unsupported =
false;
117 if (Opt.matches(UnsupportedOpt)) {
118 if (Opt.getID() == options::OPT_fsanitize_EQ &&
119 A->getValues().size() == 1) {
120 std::string SanitizeVal = A->getValue();
121 if (SanitizeVal ==
"address") {
128 DAL->eraseArg(Opt.getID());
139 if (!BoundArch.empty()) {
140 DAL->eraseArg(options::OPT_march_EQ);
141 DAL->AddJoinedArg(
nullptr, Opts.getOption(options::OPT_march_EQ),
148 HostTC.addClangWarningOptions(CC1Args);
153 return HostTC.GetCXXStdlibType(Args);
157 ArgStringList &CC1Args)
const {
158 SYCLInstallation.addSYCLIncludeArgs(DriverArgs, CC1Args);
162 ArgStringList &CC1Args)
const {
163 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
167 ArgStringList &CC1Args)
const {
168 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.