Skip to content

Commit 97c3e37

Browse files
authored
[SYCLomatic] Remove extra single quoted for macro defined option parsed from the build log (#2699)
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
1 parent 94d5bae commit 97c3e37

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nvcc '-DNAMD="message"' test.cu

clang/test/dpct/compilation_database/parse_single_quoted_str/test.cu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
// RUN: %if build_lit %{icpx -DNAMD="\"3.0b3\"" -c -fsycl %T/out/test.dp.cpp -o %T/out/test.dp.o %}
88
// RUN: FileCheck %S/test_isolate.cu --match-full-lines --input-file %T/out/test_isolate.dp.cpp
99

10+
// RUN: rm -rf out
11+
// RUN: cat %S/build.log > %T/build.log
12+
// RUN: not dpct -intercept-build --parse-build-log build.log
13+
// RUN: dpct --format-range=none -in-root=./ -out-root=%T/out -p ./ --cuda-include-path="%cuda-path/include"
14+
// RUN: FileCheck %s --match-full-lines --input-file %T/out/test.dp.cpp
15+
16+
1017
// CHECK: #include <sycl/sycl.hpp>
1118
// CHECK-NEXT: #include <dpct/dpct.hpp>
1219
// CHECK-NEXT: #include <iostream>

clang/tools/scan-build-py/lib/libscanbuild/compilation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,10 @@ def parse_args(args, directory='.'):
581581
arg = arg.replace('"', '')
582582
flags.append(arg)
583583
pass
584+
# Remove ' for case option like: '-DNAMD="message"' from build log file.
585+
elif re.match(r'\'-D', arg):
586+
new_arg = arg.strip('\'')
587+
flags.append(new_arg)
584588
# and consider everything else as compile option.
585589
else:
586590
flags.append(arg)

0 commit comments

Comments
 (0)