clang: lib/Driver/ToolChains/SYCL.cpp Source File (original) (raw)
1
2
3
4
5
6
7
10#include "llvm/Support/Path.h"
11
15using namespace clang;
17
19 const Driver &D, const llvm::Triple &HostTriple,
20 const llvm::opt::ArgList &Args) {}
21
23 const ArgList &DriverArgs, ArgStringList &CC1Args) const {
24 if (DriverArgs.hasArg(clang::driver::options::OPT_nobuiltininc))
25 return;
26
27
28
29
30}
31
32
34 static constexpr options::ID UnsupportedOpts[] = {
35 options::OPT_fsanitize_EQ,
36 options::OPT_fcf_protection_EQ,
37 options::OPT_fprofile_generate,
38 options::OPT_fprofile_generate_EQ,
39 options::OPT_fno_profile_generate,
40 options::OPT_ftest_coverage,
41 options::OPT_fno_test_coverage,
42 options::OPT_fcoverage_mapping,
43 options::OPT_fno_coverage_mapping,
44 options::OPT_coverage,
45 options::OPT_fprofile_instr_generate,
46 options::OPT_fprofile_instr_generate_EQ,
47 options::OPT_fno_profile_instr_generate,
48 options::OPT_fprofile_arcs,
49 options::OPT_fno_profile_arcs,
50 options::OPT_fcreate_profile,
51 options::OPT_fprofile_instr_use,
52 options::OPT_fprofile_instr_use_EQ,
53 options::OPT_forder_file_instrumentation,
54 options::OPT_fcs_profile_generate,
55 options::OPT_fcs_profile_generate_EQ,
56 };
57 return UnsupportedOpts;
58}
59
61 const ToolChain &HostTC, const ArgList &Args)
62 : ToolChain(D, Triple, Args), HostTC(HostTC),
63 SYCLInstallation(D, Triple, Args) {
64
65
67
68
70 if (const Arg *A = Args.getLastArg(Opt)) {
71 D.Diag(clang::diag::warn_drv_unsupported_option_for_target)
72 << A->getAsString(Args) << getTriple().str();
73 }
74 }
75}
76
78 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
81}
82
83llvm::opt::DerivedArgList *
85 StringRef BoundArch,
87 DerivedArgList *DAL =
88 HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
89
90 bool IsNewDAL = false;
91 if (!DAL) {
92 DAL = new DerivedArgList(Args.getBaseArgs());
93 IsNewDAL = true;
94 }
95
96 for (Arg *A : Args) {
97
98
99 auto Opt(A->getOption());
100 bool Unsupported = false;
102 if (Opt.matches(UnsupportedOpt)) {
103 if (Opt.getID() == options::OPT_fsanitize_EQ &&
104 A->getValues().size() == 1) {
105 std::string SanitizeVal = A->getValue();
106 if (SanitizeVal == "address") {
107 if (IsNewDAL)
108 DAL->append(A);
109 continue;
110 }
111 }
112 if (!IsNewDAL)
113 DAL->eraseArg(Opt.getID());
114 Unsupported = true;
115 }
116 }
117 if (Unsupported)
118 continue;
119 if (IsNewDAL)
120 DAL->append(A);
121 }
122
124 if (!BoundArch.empty()) {
125 DAL->eraseArg(options::OPT_march_EQ);
126 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ),
127 BoundArch);
128 }
129 return DAL;
130}
131
134}
135
139}
140
142 ArgStringList &CC1Args) const {
144}
145
147 ArgStringList &CC1Args) const {
149}
150
152 ArgStringList &CC1Args) const {
154}
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.