Skip to content

Commit 3b20615

Browse files
mdtoguchibader
authored andcommitted
[SYCL][Driver] Allow for -g0 to override default setting with -fintelfpga (#678)
When using -fintelfpga, -g is the default. Allow for the user to specify a -gN option on the command line to override. Signed-off-by: Michael D Toguchi <michael.d.toguchi@intel.com>
1 parent 8a3b7d9 commit 3b20615

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,11 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
402402
// Use of -fintelfpga implies -g and -MMD
403403
if (Args.hasArg(options::OPT_fintelfpga)) {
404404
DAL->AddFlagArg(0, Opts.getOption(options::OPT_MMD));
405-
DAL->AddFlagArg(0, Opts.getOption(options::OPT_g_Flag));
405+
// if any -gN option is provided, use that.
406+
if (Arg *A = Args.getLastArg(options::OPT_gN_Group))
407+
DAL->append(A);
408+
else
409+
DAL->AddFlagArg(0, Opts.getOption(options::OPT_g_Flag));
406410
}
407411

408412
// Add a default value of -mlinker-version=, if one was given and the user

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
// CHK-TOOLS-INTELFPGA: clang{{.*}} "-debug-info-kind=limited" {{.*}} "-dependency-file"
1010
// CHK-TOOLS-INTELFPGA: aoc{{.*}} "-dep-files={{.*}}"
1111

12+
/// -fintelfpga implies -g but -g0 should override
13+
// RUN: %clang++ -### -target x86_64-unknown-linux-gnu -g0 -fsycl -fintelfpga %s 2>&1 \
14+
// RUN: | FileCheck -check-prefix=CHK-TOOLS-INTELFPGA-G0 %s
15+
// CHK-TOOLS-INTELFPGA-G0-NOT: clang{{.*}} "-debug-info-kind=limited"
16+
1217
/// -fintelfpga -fsycl-link tests
1318
// RUN: touch %t.o
1419
// RUN: %clang++ -### -target x86_64-unknown-linux-gnu -fsycl -fintelfpga -fsycl-link %t.o 2>&1 \

0 commit comments

Comments
 (0)