[clang] Thread Safety Analysis: Support attributes on function pointers (PR #191187)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 27 06:19:12 PDT 2026


================
@@ -4306,6 +4306,9 @@ def warn_thread_attribute_not_on_scoped_lockable_param : Warning<
 def warn_thread_attribute_requires_preceded : Warning<
   "%0 attribute on %1 must be preceded by %2 attribute">,
   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
+def warn_thread_attribute_not_on_fun_ptr : Warning<
+  "%0 attribute on a %select{variable|field}1 requires the %select{variable|field}1 to be of function pointer type">,
+  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
----------------
AaronBallman wrote:

Not for this PR: so many of these are `DefaultIgnore` but really shouldn't be because the attribute is being ignored in these cases and the user may not know about it depending on how they enable diagnostics: https://godbolt.org/z/vT51xf4zK

https://github.com/llvm/llvm-project/pull/191187


More information about the cfe-commits mailing list