Skip to content

Commit bc068dd

Browse files
committed
Address review comments from Artem
1 parent 571e8df commit bc068dd

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,7 @@ def fsycl_host_compiler_EQ : Joined<["-"], "fsycl-host-compiler=">,
25232523
"compilation with during SYCL offload compiles.">;
25242524
def fsycl_host_compiler_options_EQ : Joined<["-"], "fsycl-host-compiler-options=">,
25252525
Flags<[CoreOption]>, HelpText<"When performing the host compilation with "
2526-
"-fsycl-host-compiler specified, us the given options during that compile. "
2526+
"-fsycl-host-compiler specified, use the given options during that compile. "
25272527
"Options are expected to be a quoted list of space separated options.">;
25282528
def fsyntax_only : Flag<["-"], "fsyntax-only">,
25292529
Flags<[NoXarchOption,CoreOption,CC1Option,FC1Option]>, Group<Action_Group>;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4210,8 +4210,7 @@ static bool ContainsWrapperAction(const Action *A) {
42104210
void Clang::ConstructHostCompilerJob(Compilation &C, const JobAction &JA,
42114211
const InputInfo &Output,
42124212
const InputInfoList &Inputs,
4213-
const llvm::opt::ArgList &TCArgs,
4214-
const Tool *T) const {
4213+
const llvm::opt::ArgList &TCArgs) const {
42154214

42164215
// The Host compilation step that occurs here is constructed based on the
42174216
// input from the user. This consists of the compiler to call and the
@@ -4224,7 +4223,7 @@ void Clang::ConstructHostCompilerJob(Compilation &C, const JobAction &JA,
42244223
HostCompileArgs.push_back(InputFile.getFilename());
42254224

42264225
// When performing the host compilation, we are expecting to only be
4227-
// creating intermediate files. These being preprocessed, assembly or
4226+
// creating intermediate files, namely preprocessor output, assembly or
42284227
// object files.
42294228
// We are making assumptions in regards to what options are used to
42304229
// generate these intermediate files.
@@ -4257,6 +4256,9 @@ void Clang::ConstructHostCompilerJob(Compilation &C, const JobAction &JA,
42574256
};
42584257
// FIXME: Reuse existing toolchains which are already supported to put
42594258
// together the options.
4259+
// FIXME: For any potential obscure host compilers that do not use the
4260+
// 'standard' set of options, we should provide a user interface that allows
4261+
// users to override the implied options.
42604262
if (isa<PreprocessJobAction>(JA)) {
42614263
if (IsMSVCHostCompiler) {
42624264
// Check the output file, if it is 'stdout' we want to use -E.
@@ -4341,6 +4343,7 @@ void Clang::ConstructHostCompilerJob(Compilation &C, const JobAction &JA,
43414343
llvm::transform(TargetArgs, std::back_inserter(HostCompileArgs),
43424344
[&TCArgs](StringRef A) { return TCArgs.MakeArgString(A); });
43434345
}
4346+
const Tool *T = TC.SelectTool(JA);
43444347
auto Cmd = std::make_unique<Command>(JA, *T, ResponseFileSupport::None(),
43454348
TCArgs.MakeArgString(ExecPath),
43464349
HostCompileArgs, None);
@@ -4381,11 +4384,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
43814384
IsHeaderModulePrecompile || Inputs.size() == 1) &&
43824385
"Unable to handle multiple inputs.");
43834386

4384-
// Perform the host compilation using an external compiler if the user
4387+
// Perform the SYCL host compilation using an external compiler if the user
43854388
// requested.
43864389
if (Args.hasArg(options::OPT_fsycl_host_compiler_EQ) && IsSYCL &&
43874390
!IsSYCLOffloadDevice) {
4388-
ConstructHostCompilerJob(C, JA, Output, Inputs, Args, this);
4391+
ConstructHostCompilerJob(C, JA, Output, Inputs, Args);
43894392
return;
43904393
}
43914394

clang/lib/Driver/ToolChains/Clang.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ class LLVM_LIBRARY_VISIBILITY Clang : public Tool {
9191
void ConstructHostCompilerJob(Compilation &C, const JobAction &JA,
9292
const InputInfo &Output,
9393
const InputInfoList &Inputs,
94-
const llvm::opt::ArgList &TCArgs,
95-
const Tool *T) const;
94+
const llvm::opt::ArgList &TCArgs) const;
9695

9796
mutable std::unique_ptr<llvm::raw_fd_ostream> CompilationDatabase = nullptr;
9897
void DumpCompilationDatabase(Compilation &C, StringRef Filename,

sycl/doc/UsersManual.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ and not recommended to use in production environment.
238238
expected that the options used here are compatible with the compiler
239239
specified via -fsycl-host-compiler=<arg>.
240240

241+
NOTE: Using -fsycl-host-compiler-options to pass any kind of phase limiting
242+
options (e.g. -c, -E, -S) may interfere with the expected output set during
243+
the host compilation. Doing so is considered undefined behavior.
244+
241245
# Example: SYCL device code compilation
242246

243247
To invoke SYCL device compiler set `-fsycl-device-only` flag.

0 commit comments

Comments
 (0)