CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
90 lines
2.2 KiB
Plaintext
90 lines
2.2 KiB
Plaintext
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UnretainedLocalVarsChecker -fobjc-runtime-has-weak -fobjc-weak -fobjc-arc -verify %s
|
|
|
|
#import "objc-mock-types.h"
|
|
|
|
SomeObj *provide();
|
|
void someFunction();
|
|
|
|
namespace raw_ptr {
|
|
|
|
void foo() {
|
|
SomeObj *bar = [[SomeObj alloc] init];
|
|
[bar doWork];
|
|
}
|
|
|
|
void foo2() {
|
|
SomeObj *bar = provide();
|
|
[bar doWork];
|
|
}
|
|
|
|
void foo3() {
|
|
SomeObj *bar = provide();
|
|
IOSurfaceRef surface;
|
|
// expected-warning@-1{{Local variable 'surface' is unretained and unsafe [alpha.webkit.UnretainedLocalVarsChecker]}}
|
|
}
|
|
|
|
void foo4() {
|
|
__weak SomeObj *bar = provide();
|
|
}
|
|
|
|
void bar() {
|
|
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 10);
|
|
// expected-warning@-1{{Local variable 'array' is unretained and unsafe [alpha.webkit.UnretainedLocalVarsChecker]}}
|
|
CFArrayAppendValue(array, nullptr);
|
|
}
|
|
|
|
void baz() {
|
|
auto queue = dispatch_queue_create("some queue", nullptr);
|
|
dispatch_queue_get_label(queue);
|
|
}
|
|
|
|
} // namespace raw_ptr
|
|
|
|
namespace const_global {
|
|
|
|
extern NSString * const SomeConstant;
|
|
extern CFDictionaryRef const SomeDictionary;
|
|
extern dispatch_queue_t const SomeDispatch;
|
|
void doWork(NSString *, CFDictionaryRef, dispatch_queue_t);
|
|
void use_const_global() {
|
|
doWork(SomeConstant, SomeDictionary, SomeDispatch);
|
|
}
|
|
|
|
NSString *provide_str();
|
|
CFDictionaryRef provide_dict();
|
|
dispatch_queue_t provide_dispatch();
|
|
void use_const_local() {
|
|
NSString * const str = provide_str();
|
|
CFDictionaryRef dict = provide_dict();
|
|
// expected-warning@-1{{Local variable 'dict' is unretained and unsafe [alpha.webkit.UnretainedLocalVarsChecker]}}
|
|
auto dispatch = provide_dispatch();
|
|
doWork(str, dict, dispatch);
|
|
}
|
|
|
|
} // namespace const_global
|
|
|
|
@interface AnotherObj : NSObject
|
|
- (void)foo:(SomeObj *)obj;
|
|
@end
|
|
|
|
@implementation AnotherObj
|
|
- (void)foo:(SomeObj*)obj {
|
|
SomeObj* obj2 = obj;
|
|
SomeObj* obj3 = provide();
|
|
obj = nullptr;
|
|
[obj2 doWork];
|
|
[obj3 doWork];
|
|
}
|
|
|
|
- (void)bar {
|
|
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 10);
|
|
// expected-warning@-1{{Local variable 'array' is unretained and unsafe [alpha.webkit.UnretainedLocalVarsChecker]}}
|
|
CFArrayAppendValue(array, nullptr);
|
|
}
|
|
|
|
- (void)baz {
|
|
auto queue = dispatch_queue_create("some queue", nullptr);
|
|
dispatch_queue_get_label(queue);
|
|
}
|
|
@end
|