objective-C arc: load of a __weak object happens via call to
objc_loadWeak. This retains and autorelease the weakly-refereced object. This hidden autorelease sometimes makes __weak variable alive even after the weak reference is erased, because the object is still referenced by an autorelease pool. This patch overcomes this behavior by loading a weak object via call to objc_loadWeakRetained(), followng it by objc_release at appropriate place, thereby removing the hidden autorelease. // rdar://10849570 llvm-svn: 168740
Showing
- clang/lib/CodeGen/CGCall.cpp 12 additions, 4 deletionsclang/lib/CodeGen/CGCall.cpp
- clang/lib/CodeGen/CGExpr.cpp 5 additions, 2 deletionsclang/lib/CodeGen/CGExpr.cpp
- clang/lib/Sema/SemaExpr.cpp 6 additions, 0 deletionsclang/lib/Sema/SemaExpr.cpp
- clang/lib/Sema/SemaInit.cpp 19 additions, 7 deletionsclang/lib/Sema/SemaInit.cpp
- clang/test/CodeGenObjC/arc-blocks.m 3 additions, 2 deletionsclang/test/CodeGenObjC/arc-blocks.m
- clang/test/CodeGenObjC/arc-foreach.m 2 additions, 1 deletionclang/test/CodeGenObjC/arc-foreach.m
- clang/test/CodeGenObjC/arc-loadweakretained-release.m 77 additions, 0 deletionsclang/test/CodeGenObjC/arc-loadweakretained-release.m
- clang/test/CodeGenObjC/arc.m 6 additions, 1 deletionclang/test/CodeGenObjC/arc.m
- clang/test/CodeGenObjCXX/arc.mm 6 additions, 1 deletionclang/test/CodeGenObjCXX/arc.mm
Loading
Please register or sign in to comment