Lines Matching refs:obj
82 bool write_into_out_param_on_success(OS_RETURNS_RETAINED OSObject **obj);
85 OSObject *obj; in use_out_param() local
86 if (write_into_out_param_on_success(&obj)) { in use_out_param()
87 obj->release(); in use_out_param()
92 OSObject *obj; in use_out_param_leak() local
93 …write_into_out_param_on_success(&obj); // expected-note-re{{Call to function 'write_into_out_param… in use_out_param_leak()
97 bool write_into_out_param_on_failure(OS_RETURNS_RETAINED_ON_ZERO OSObject **obj);
100 OSObject *obj; in use_out_param_leak2() local
101 …write_into_out_param_on_failure(&obj); // expected-note-re{{Call to function 'write_into_out_param… in use_out_param_leak2()
106 OSObject *obj; in use_out_param_on_failure() local
107 if (!write_into_out_param_on_failure(&obj)) { in use_out_param_on_failure()
108 obj->release(); in use_out_param_on_failure()
112 IOReturn write_into_out_param_on_nonzero(OS_RETURNS_RETAINED_ON_NONZERO OSObject **obj);
115 OSObject *obj; in use_out_param_on_nonzero() local
116 if (write_into_out_param_on_nonzero(&obj) != kIOReturnSuccess) { in use_out_param_on_nonzero()
117 obj->release(); in use_out_param_on_nonzero()
164 char *write_into_out_param_on_nonnull(OS_RETURNS_RETAINED OSObject **obj);
167 OSObject *obj; in use_out_param_osreturn_on_nonnull() local
168 if (write_into_out_param_on_nonnull(&obj)) { in use_out_param_osreturn_on_nonnull()
169 obj->release(); in use_out_param_osreturn_on_nonnull()
174 OSObject *obj; in use_out_param_leak_osreturn_on_nonnull() local
175 …write_into_out_param_on_nonnull(&obj); // expected-note-re{{Call to function 'write_into_out_param… in use_out_param_leak_osreturn_on_nonnull()
179 bool write_optional_out_param(OS_RETURNS_RETAINED OSObject **obj=nullptr);
185 OSReturn write_into_out_param_on_os_success(OS_RETURNS_RETAINED OSObject **obj);
187 void write_into_non_retained_out_param(OS_RETURNS_NOT_RETAINED OSObject **obj);
190 OSObject *obj; in use_write_into_non_retained_out_param() local
191 write_into_non_retained_out_param(&obj); in use_write_into_non_retained_out_param()
195 OSObject *obj; in use_write_into_non_retained_out_param_uaf() local
196 …write_into_non_retained_out_param(&obj); // expected-note-re{{Call to function 'write_into_non_ret… in use_write_into_non_retained_out_param_uaf()
197 …obj->release(); // expected-warning{{Incorrect decrement of the reference count of an object that … in use_write_into_non_retained_out_param_uaf()
201 void always_write_into_out_param(OS_RETURNS_RETAINED OSObject **obj);
203 void pass_through_out_param(OSObject **obj) { in pass_through_out_param() argument
204 always_write_into_out_param(obj); in pass_through_out_param()
207 void always_write_into_out_param_has_source(OS_RETURNS_RETAINED OSObject **obj) { in always_write_into_out_param_has_source() argument
208 …*obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObject' with … in always_write_into_out_param_has_source()
212 OSObject *obj; in use_always_write_into_out_param_has_source_leak() local
213 …always_write_into_out_param_has_source(&obj); // expected-note{{Calling 'always_write_into_out_par… in use_always_write_into_out_param_has_source_leak()
219 OSObject *obj; in use_void_out_param_osreturn() local
220 always_write_into_out_param(&obj); in use_void_out_param_osreturn()
221 obj->release(); in use_void_out_param_osreturn()
225 OSObject *obj; in use_void_out_param_osreturn_leak() local
226 …always_write_into_out_param(&obj); // expected-note-re{{Call to function 'always_write_into_out_pa… in use_void_out_param_osreturn_leak()
231 OSObject *obj; in use_out_param_osreturn() local
232 if (write_into_out_param_on_os_success(&obj) == kOSReturnSuccess) { in use_out_param_osreturn()
233 obj->release(); in use_out_param_osreturn()
238 OSObject *obj; in use_out_param_leak_osreturn() local
239 …write_into_out_param_on_os_success(&obj); // expected-note-re{{Call to function 'write_into_out_pa… in use_out_param_leak_osreturn()
243 void cleanup(OSObject **obj);
246 __attribute__((cleanup(cleanup))) OSObject *obj; in test_cleanup_escaping() local
247 always_write_into_out_param(&obj); // no-warning, the value has escaped. in test_cleanup_escaping()
251 OSObject *obj; member
254 always_write_into_out_param(&obj); in initViaOutParamCall()
259 bool os_consume_violation_two_args(OS_CONSUME OSObject *obj, bool extra) { in os_consume_violation_two_args() argument
262 escape(obj); in os_consume_violation_two_args()
268 bool os_consume_violation(OS_CONSUME OSObject *obj) { in os_consume_violation() argument
271 escape(obj); in os_consume_violation()
277 void os_consume_ok(OS_CONSUME OSObject *obj) { in os_consume_ok() argument
278 escape(obj); in os_consume_ok()
282 …OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObje… in use_os_consume_violation() local
283 os_consume_violation(obj); // expected-note{{Calling 'os_consume_violation'}} in use_os_consume_violation()
289 …OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObje… in use_os_consume_violation_two_args() local
290 …os_consume_violation_two_args(obj, coin()); // expected-note{{Calling 'os_consume_violation_two_ar… in use_os_consume_violation_two_args()
296 OSObject *obj = new OSObject; in use_os_consume_ok() local
297 os_consume_ok(obj); in use_os_consume_ok()
301 OSObject *obj = new OSObject; in test_escaping_into_voidstar() local
302 escape(obj); in test_escaping_into_voidstar()
306 OSObject *obj = new OSObject; in test_escape_has_source() local
307 if (obj) in test_escape_has_source()
308 escape_with_source(obj); in test_escape_has_source()
493 void check_cast_behavior(OSObject *obj) { in check_cast_behavior() argument
494 OSArray *arr1 = OSDynamicCast(OSArray, obj); in check_cast_behavior()
495 clang_analyzer_eval(arr1 == obj); // expected-warning{{TRUE}} in check_cast_behavior()
500 OSArray *arr2 = OSRequiredCast(OSArray, obj); in check_cast_behavior()
501 clang_analyzer_eval(arr2 == obj); // expected-warning{{TRUE}} in check_cast_behavior()
505 unsigned int check_dynamic_cast_no_null_on_orig(OSObject *obj) { in check_dynamic_cast_no_null_on_orig() argument
506 OSArray *arr = OSDynamicCast(OSArray, obj); in check_dynamic_cast_no_null_on_orig()
513 return obj->foo(); // no-warning in check_dynamic_cast_no_null_on_orig()
517 void check_dynamic_cast_null_branch(OSObject *obj) { in check_dynamic_cast_null_branch() argument
519 …OSArray *arr = OSDynamicCast(OSArray, obj); // expected-note{{Assuming dynamic cast returns null d… in check_dynamic_cast_null_branch()
673 …OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObje… in test_smart_ptr_uaf() local
675 OSObjectPtr p(obj); // expected-note{{Calling constructor for 'smart_ptr<OSObject>'}} in test_smart_ptr_uaf()
689 obj->release(); // expected-note{{Object released}} in test_smart_ptr_uaf()
690 obj->release(); // expected-warning{{Reference-counted object is used after it is released}} in test_smart_ptr_uaf()
695 …OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObje… in test_smart_ptr_leak() local
697 OSObjectPtr p(obj); // expected-note{{Calling constructor for 'smart_ptr<OSObject>'}} in test_smart_ptr_leak()
716 OSObject *obj = new OSObject; in test_smart_ptr_no_leak() local
718 OSObjectPtr p(obj); in test_smart_ptr_no_leak()
720 obj->release(); in test_smart_ptr_no_leak()
751 void escape_elsewhere(OSObject *obj);
754 …OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObje… in test_free_on_escaped_object_diagnostics() local
755 escape_elsewhere(obj); // expected-note{{Object is now not exclusively owned}} in test_free_on_escaped_object_diagnostics()
756 obj->free(); // expected-note{{'free' called on an object that may be referenced elsewhere}} in test_free_on_escaped_object_diagnostics()
761 OSObject *obj = new OSObject; in test_tagged_retain_no_leak() local
762 obj->taggedRelease(); in test_tagged_retain_no_leak()
766 OSObject *obj = new OSObject; in test_tagged_retain_no_uaf() local
767 obj->taggedRetain(); in test_tagged_retain_no_uaf()
768 obj->release(); in test_tagged_retain_no_uaf()
769 obj->release(); in test_tagged_retain_no_uaf()
800 WeirdResult outParamWithWeirdResult(OS_RETURNS_RETAINED_ON_ZERO OSObject **obj);
803 OSObject *obj; in testOutParamWithWeirdResult() local
804 return outParamWithWeirdResult(&obj); // no-warning in testOutParamWithWeirdResult()