[PATCH] D112334: [clang-tidy] Suppress readability-static-access-through-instance for CUDA built-in variables

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 25 08:38:40 PDT 2021


carlosgalvezp added a comment.

Thanks for the review!

I'm not super happy with the commit in the sense that it feels more like a workaround than a proper fix, with the hardcoded name `__cuda_built_in` and so on. But honestly I don't know how implement it more properly, for example check if the `BaseTypeName` is a CUDA built-in type. Another issue is that currently one can't ignore warnings from system headers (like `__clang_cuda_builtin_vars.h`)if they come from a macro defined there. But I suppose that's a harder problem to tackle.

But if you are happy with the patch I can go ahead and merge, and come back to it if I learn how to improve it later on as I get to learn more about the codebase.



================
Comment at: clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp:75
+  // Do not warn for CUDA built-in variables.
+  if (StringRef(BaseTypeName).contains("__cuda_builtin_"))
+    return;
----------------
aaron.ballman wrote:
> I presume we want this to strictly be a prefix?
Sure, but then I can't put the test in a named namespace. I changed it to anonymous namespace + link to Bugzilla, hope it works.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112334/new/

https://reviews.llvm.org/D112334



More information about the cfe-commits mailing list