cli tool that makes objective-c/c++ projects arc-compliant. safe to run on already arc-compliant code.
make install
make install PREFIX=~/.localarcify <path> # patch files in place
arcify <path> --dry-run # preview changes with colored diff
arcify <path> --verbose # show each patched file
arcify --versionswiftpm projects (those with a
Package.swift) automatically skip.build/.
retain / release / autorelease — wrapped in #if !__has_feature(objc_arc), consecutive calls grouped into one block
[_commandBuffer retain];
[_argEncoderBuffer release];
[_argEncoderSampler release];
[_argEncoderTexture release];
// ->
#if !__has_feature(objc_arc)
[_commandBuffer retain];
#endif // !__has_feature(objc_arc)
#if !__has_feature(objc_arc)
[_argEncoderBuffer release];
[_argEncoderSampler release];
[_argEncoderTexture release];
#endif // !__has_feature(objc_arc)NSAutoreleasePool — alloc/init and drain/release each get their own guard
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[pool drain];
// ->
#if !__has_feature(objc_arc)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif // !__has_feature(objc_arc)
#if !__has_feature(objc_arc)
[pool drain];
#endif // !__has_feature(objc_arc)(void*) bridge casts — only when the source is self or a message send
context->userData = (void*)self; -> (__bridge void*)self
context->handler = (void*)[obj handler]; -> (__bridge void*)[obj handler]implicit void* return — objc alloc/init returned as void*
return [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
// -> return (__bridge void*)[[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];id<Protocol> casts
colorTexture = id<MTLTexture>(res->GetRawResource());
// -> (__bridge id<MTLTexture>)(void*)(res->GetRawResource())metal type upcasting — id<MTLResource> upcasted to the specific type implied by the getter
id<MTLResource> buf = metalBuffer->GetBufferId(); -> id<MTLBuffer>
id<MTLResource> tex = metalTex->GetTextureId(); -> id<MTLTexture>────────────────────────────────────────────────────────────
pxr/imaging/hgiMetal/hgi.mm
────────────────────────────────────────────────────────────
_commandBuffer = [_commandQueue commandBuffer];
+ #if !__has_feature(objc_arc)
[_commandBuffer retain];
+ #endif // !__has_feature(objc_arc)
────────────────────────────────────────────────────────────
arcify: scanned 24 files, would patch 14.requires swift 6.1+. run
make helpfor all targets.
