[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


================
@@ -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())
----------------
AaronBallman wrote:

What about a reference to a function pointer type?

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


More information about the cfe-commits mailing list