Skip to content

Commit df5f1ab

Browse files
authored
[Driver][SYCL][FPGA] Fix missing dependency file when named (#2711)
When compiling for -fintelfpga and using a named dependency output file make sure that output file is used when bundling.
1 parent e31b94e commit df5f1ab

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,12 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
11361136
if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
11371137
DepFile = MF->getValue();
11381138
C.addFailureResultFile(DepFile, &JA);
1139+
// Populate the named dependency file to be used in the bundle
1140+
// or passed to the offline compilation.
1141+
if (Args.hasArg(options::OPT_fintelfpga) &&
1142+
JA.isDeviceOffloading(Action::OFK_SYCL))
1143+
C.getDriver().addFPGATempDepFile(
1144+
DepFile, Clang::getBaseInputName(Args, Inputs[0]));
11391145
} else if (Output.getType() == types::TY_Dependencies) {
11401146
DepFile = Output.getFilename();
11411147
} else if (!ArgMD) {

clang/test/Driver/sycl-offload-intelfpga.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@
269269
// RUN: touch %t-1.cpp
270270
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga %t-1.cpp -c -o dummy.o 2>&1 \
271271
// RUN: | FileCheck -check-prefixes=CHK-FPGA-DEP-FILES3,CHK-FPGA-DEP-FILES3-LIN %s
272+
// RUN: %clangxx -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga %t-1.cpp -c -MMD -MF"dummy.d" 2>&1 \
273+
// RUN: | FileCheck -check-prefixes=CHK-FPGA-DEP-FILES3,CHK-FPGA-DEP-FILES3-LIN %s
272274
// RUN: %clang_cl -### -fsycl -fintelfpga %t-1.cpp -c -Fodummy.obj 2>&1 \
273275
// RUN: | FileCheck -check-prefixes=CHK-FPGA-DEP-FILES3,CHK-FPGA-DEP-FILES3-WIN %s
274276
// CHK-FPGA-DEP-FILES3: clang{{.*}} "-dependency-file" "[[OUTPUT:.+\.d]]"

0 commit comments

Comments
 (0)