[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:52:21 PDT 2026


================
@@ -436,10 +436,24 @@ static void checkAttrArgsAreCapabilityObjs(Sema &S, Decl *D,
   }
 }
 
+/// Checks that thread-safety attributes on variables or fields apply only to
+/// function pointer types.
+static bool checkThreadSafetyValueDeclIsFunPtr(Sema &S, const ValueDecl *VD,
+                                               const AttributeCommonInfo &A) {
+  if (VD->getType()->isDependentType() ||
+      VD->getType()->isFunctionPointerType())
----------------
melver wrote:

Fixed and added test.

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


More information about the cfe-commits mailing list