-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Has anyone run clang-tidy on Cuda code before?
Naively patching the permitted_file_types
to include , ".cu", ".cuh"
kinda works in the sense that the aspect will find issues like
/home/user/.cache/bazel/_bazel_user/5f48ff965103b174f3c248651ebad24d/sandbox/linux-sandbox/14/execroot/_main/path/to/cuda/code.cu:47:5: error: variable 'i' of type 'int' can be declared 'const' [misc-const-correctness,-warnings-as-errors]
47 | int i = x0 + x + (y0 + y) * width;
| ^
| const
but since the .cu file isn't actually C++ code but Cuda code it will eventually fail with "unignorable" diagnostic errors like
./path/to/cuda/header.cuh:70:9: error: expected expression [clang-diagnostic-error]
70 | <<<grid_dim, block_dim, 0, stream>>>(src_v, src_width / 2, dst_v, x_start / 2, y_start / 2, x_end / 2, y_end / 2);
| ^
https://stackoverflow.com/a/53863779/5559867 makes it sound like generally it should be possible to get clang-tidy to compile the cuda code correctly for static analysis.
Just throwing this out there for now. If anybody got something like this working I'd be curious :)
Metadata
Metadata
Assignees
Labels
No labels