Skip to content

Commit

Permalink
[SYCLomatic] Fix lit test cmp-cmds-linker-entry-src-files run failed …
Browse files Browse the repository at this point in the history
…where CUDA SDK is installed in default directory while nvcc is not available in env PATH (#2522)



Signed-off-by: chenwei.sun <[email protected]>
  • Loading branch information
tomflinda authored Dec 2, 2024
1 parent 9cd8c12 commit da6345c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions clang/tools/scan-build-py/lib/libear/ear.c
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,7 @@ int is_tool_available(char const *argv[], size_t const argc) {
int is_nvcc = 0;
int is_nvcc_available = 0;

const char *env_var = "INTERCEPT_COMPILE_PATH";
char *value = getenv(env_var);
char *value = getenv("INTERCEPT_COMPILE_PATH");
if (value) {
is_nvcc_available = 1;
}
Expand All @@ -1731,6 +1730,10 @@ int is_tool_available(char const *argv[], size_t const argc) {
pathname[1] == 'v' && pathname[0] == 'n') {
// To handle case like "nvcc"
is_nvcc = 1;
value = getenv("IS_INTERCEPT_COMPILE_PATH_FROM_ENV_PATH");
if (value && *value == '0') {
return 0;
}
}
if (len > 4 && pathname[len - 1] == 'c' && pathname[len - 2] == 'c' &&
pathname[len - 3] == 'v' && pathname[len - 4] == 'n' &&
Expand Down
4 changes: 3 additions & 1 deletion clang/tools/scan-build-py/lib/libscanbuild/intercept.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def find_nvcc_and_set_env_variable():

if nvcc_path:
set_sys_env_var("INTERCEPT_COMPILE_PATH", nvcc_path)
set_sys_env_var("IS_INTERCEPT_COMPILE_PATH_FROM_ENV_PATH", "1")
return

# Search for nvcc in CUDA SDK default installation directories.
Expand All @@ -207,7 +208,8 @@ def find_nvcc_and_set_env_variable():
break

if nvcc_path:
set_system_environment_variable("INTERCEPT_COMPILE_PATH", nvcc_path)
set_sys_env_var("INTERCEPT_COMPILE_PATH", nvcc_path)
set_sys_env_var("IS_INTERCEPT_COMPILE_PATH_FROM_ENV_PATH", "0")
return

# SYCLomatic_CUSTOMIZATION end
Expand Down

0 comments on commit da6345c

Please sign in to comment.