================
@@ -8370,4 +8370,32 @@ void testDependent(int n) {
callDependent<void (&)(int)>(callback, n); // expected-note {{in
instantiation of function template specialization
'FunctionPointers::callDependent<void (&)(int)>' requested here}}
}
+// lock_returned on a function pointer or reference.
+struct Guarded {
+ Mutex mu;
+ int data GUARDED_BY(mu);
----------------
vtjnash wrote:
The answer to "should there be more tests" is almost always yes, haha. I'll
have to make a new PR for that, since it's broken right now. Claude says:
4. Member function pointer test. The reviewer's question exposed a real gap,
and it predates this PR. An attribute on a function-pointer field that names a
sibling member translated with no implicit object, so g->mu_of() with
LOCK_RETURNED(&mu) yielded a bare mu that never matched g->mu. The same
happened for ACQUIRE(mu) on fields from the original function-pointer commit. I
fixed it in clang/lib/Analysis/ThreadSafetyCommon.cpp with a small helper that
uses the member-access base as the self argument, in both the general attribute
path and the lock_returned path.
https://github.com/llvm/llvm-project/pull/226561
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits