================
@@ -6087,9 +6215,37 @@ class Return {
const Foo &returns_constref_shared_locks_required()
SHARED_LOCKS_REQUIRED(mu) {
return foo;
}
+
+ Foo *returns_ptr_exclusive_locks_required() EXCLUSIVE_LOCKS_REQUIRED(mu) {
+ return &foo;
+ }
+
+ Foo *returns_pt_ptr_exclusive_locks_required() EXCLUSIVE_LOCKS_REQUIRED(mu) {
+ return foo_ptr;
+ }
+
+ Foo *returns_ptr_shared_locks_required() SHARED_LOCKS_REQUIRED(mu) {
+ return &foo; // expected-warning {{returning pointer to
variable 'foo' requires holding mutex 'mu' exclusively}}
+ }
+
+ Foo *returns_pt_ptr_shared_locks_required() SHARED_LOCKS_REQUIRED(mu) {
+ return foo_ptr; // expected-warning {{returning pointer
'foo_ptr' requires holding mutex 'mu' exclusively}}
+ }
+
+ const Foo *returns_constptr_shared_locks_required()
SHARED_LOCKS_REQUIRED(mu) {
+ return &foo;
+ }
+
+ const Foo *returns_pt_constptr_shared_locks_required()
SHARED_LOCKS_REQUIRED(mu) {
+ return foo_ptr;
+ }
Foo *returns_ptr() {
- return &foo; // FIXME -- Do we want to warn on this ?
+ return &foo; // expected-warning {{returning pointer to
variable 'foo' requires holding mutex 'mu' exclusively}}
+ }
+
+ Foo *returns_pt_ptr() {
----------------
melver wrote:
Done.
https://github.com/llvm/llvm-project/pull/127396
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits