Skip to content

Commit 94d5bae

Browse files
authored
[SYCLomatic][intercept-build] Fix bug that intercept-build reports compiler is not found in the env where toolchain is installed (#2696)
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
1 parent b982ed1 commit 94d5bae

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

  • clang/tools/scan-build-py/lib/libear

clang/tools/scan-build-py/lib/libear/ear.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,15 +493,21 @@ int eaccess(const char *pathname, int mode) {
493493
return 0;
494494
}
495495

496+
int nvcc_available = 0;
497+
char *value = getenv("INTERCEPT_COMPILE_PATH");
498+
if (value) {
499+
nvcc_available = 1;
500+
}
501+
496502
int len = strlen(pathname);
497-
if (len == 4 && pathname[3] == 'c' && pathname[2] == 'c' &&
503+
if (!nvcc_available && len == 4 && pathname[3] == 'c' && pathname[2] == 'c' &&
498504
pathname[1] == 'v' && pathname[0] == 'n') {
499505
// To handle case like "nvcc foo.cu ..."
500506
return 0;
501507
}
502-
if (len > 4 && pathname[len - 1] == 'c' && pathname[len - 2] == 'c' &&
503-
pathname[len - 3] == 'v' && pathname[len - 4] == 'n' &&
504-
pathname[len - 5] == '/') {
508+
if (!nvcc_available && len > 4 && pathname[len - 1] == 'c' &&
509+
pathname[len - 2] == 'c' && pathname[len - 3] == 'v' &&
510+
pathname[len - 4] == 'n' && pathname[len - 5] == '/') {
505511
// To handle case like "/path/to/nvcc foo.cu ..."
506512
return 0;
507513
}

0 commit comments

Comments
 (0)