[clang] Thread Safety Analysis: Support attributes on function pointers (PR #191187)
Marco Elver via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 29 06:46:02 PDT 2026
================
@@ -4096,7 +4096,7 @@ def AssertCapability : InheritableAttr {
Clang<"assert_shared_capability", 0>,
GNU<"assert_exclusive_lock">,
GNU<"assert_shared_lock">];
- let Subjects = SubjectList<[Function]>;
+ let Subjects = SubjectList<[Function, NonParmVar, Field]>;
----------------
melver wrote:
Fixed to allow all 'Var'.
Re FunctionLike: I tried that and it seems to cause a number of issues - the biggest one that it rejects dependent types outright. It didn't seem obvious to me how to fix that without introducing regressions elsewhere.
Note also, the custom diagnostic is slightly more precise and helpful - so there's value in keeping that.
https://github.com/llvm/llvm-project/pull/191187
More information about the cfe-commits
mailing list