[clang-tidy] Suppress readability-static-access-through-instance for CUDA built-in...
authorCarlos Galvez <carlosgalvezp@gmail.com>
Fri, 22 Oct 2021 17:38:34 +0000 (17:38 +0000)
committerCarlos Galvez <carlosgalvezp@gmail.com>
Tue, 26 Oct 2021 05:45:25 +0000 (05:45 +0000)
commitb43a2aee4ee946d8897880e824f4b09fe4c46143
treed0b60bdf2eb34895f5807c67881081505546d721
parent79f9dfef0da5fdabb16873726a1725e2b1c8c2c4
[clang-tidy] Suppress readability-static-access-through-instance for CUDA built-in variables

clang-tidy can be used to statically analyze CUDA code,
thanks to clang being able to compile CUDA code natively.
This makes clang-tidy the one and only open-source
static analyzer for CUDA.

However it currently warns for native CUDA built-in
variables, like threadIdx, due to the way they
are implemented in clang.

Users don't need to know the details of the clang
implementation, and they should continue to write
idiomatic code. Therefore, suppress the warning
if a CUDA built-in variable is encountered.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48758
clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-static-accessed-through-instance/__clang_cuda_builtin_vars.h [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/checkers/readability-static-accessed-through-instance.cpp