[clang] Thread Safety Analysis: Don't treat function pointer parameters as scoped capabilities (PR #211885)
Marco Elver via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 28 03:11:55 PDT 2026
================
@@ -4350,13 +4350,14 @@ def warn_thread_attribute_decl_not_pointer : Warning<
InGroup<ThreadSafetyAttributes>, DefaultIgnore;
def warn_thread_attribute_not_on_scoped_lockable_param : Warning<
"%0 attribute applies to function parameters only if their type is a "
- "reference to a 'scoped_lockable'-annotated type">,
+ "function pointer, a function reference, or a reference to a "
+ "'scoped_lockable'-annotated type">,
InGroup<ThreadSafetyAttributes>, DefaultIgnore;
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">,
+ "%0 attribute on a %select{variable|field}1 requires the %select{variable|field}1 to be of function pointer or function reference type">,
----------------
melver wrote:
This will be annoying if we compile a C codebase and it starts talking about "function reference". In the interest of brevity and unconfuse the common case, I think leaving it as before (i.e. just ".. to be of function pointer type") is fine.
https://github.com/llvm/llvm-project/pull/211885
More information about the cfe-commits
mailing list