Skip to content

Commit 1e3124c

Browse files
committed
[Driver][SYCL][FPGA] Adjust the output location for the project report
When no output specifier is given on the command line, create the output project report location in the $CWD as opposed to matching the source location if it was specified with a directory. Signed-off-by: Michael D Toguchi <[email protected]>
1 parent 5d72e6b commit 1e3124c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,14 @@ void SYCL::fpga::BackendCompiler::ConstructJob(Compilation &C,
278278
if (Ty == types::TY_INVALID)
279279
continue;
280280
if (types::isSrcFile(Ty) || Ty == types::TY_Object) {
281-
llvm::sys::path::replace_extension(AN, "prj");
282-
ReportOptArg += Args.MakeArgString(AN);
283-
break;
281+
// Output is based on the filename only so strip off any directory
282+
// information if provided with the source/object file.
283+
AN = llvm::sys::path::filename(AN);
284+
if (!AN.empty()) {
285+
llvm::sys::path::replace_extension(AN, "prj");
286+
ReportOptArg += Args.MakeArgString(AN);
287+
break;
288+
}
284289
}
285290
}
286291
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@
171171
// RUN: | FileCheck -DOUTDIR=%t_dir -check-prefix=CHK-FPGA-REPORT-OPT %s
172172
// CHK-FPGA-REPORT-OPT: aoc{{.*}} "-sycl" {{.*}} "-output-report-folder=[[OUTDIR]]{{/|\\\\}}file.prj"
173173

174+
/// -fintelfpga output report file from dir/source
175+
// RUN: mkdir -p %t_dir
176+
// RUN: touch %t_dir/dummy.cpp
177+
// RUN: %clangxx -### -fsycl -fintelfpga %t_dir/dummy.cpp 2>&1 \
178+
// RUN: | FileCheck -DOUTDIR=%t_dir -check-prefix=CHK-FPGA-REPORT-OPT2 %s
179+
// RUN: %clang_cl -### -fsycl -fintelfpga %t_dir/dummy.cpp 2>&1 \
180+
// RUN: | FileCheck -DOUTDIR=%t_dir -check-prefix=CHK-FPGA-REPORT-OPT2 %s
181+
// CHK-FPGA-REPORT-OPT2: aoc{{.*}} "-sycl" {{.*}} "-output-report-folder=dummy.prj"
182+
// CHK-FPGA-REPORT-OPT2-NOT: aoc{{.*}} "-sycl" {{.*}} "-output-report-folder=[[OUTDIR]]{{.*}}"
183+
174184
/// -fintelfpga static lib (aoco)
175185
// RUN: echo "Dummy AOCO image" > %t.aoco
176186
// RUN: echo "void foo() {}" > %t.c

0 commit comments

Comments
 (0)