]> granicus.if.org Git - clang/commit
objective-C arc: load of a __weak object happens via call to
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 27 Nov 2012 23:02:53 +0000 (23:02 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 27 Nov 2012 23:02:53 +0000 (23:02 +0000)
commit82c458ea76bf8f0981e3d1b5070c0b0e5878d784
tree1e5970626448a3183b607565ae355fa86956d644
parent7aa7eb9d0221bc67e2cd564e703a2427dc212b79
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168740 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGExpr.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaInit.cpp
test/CodeGenObjC/arc-blocks.m
test/CodeGenObjC/arc-foreach.m
test/CodeGenObjC/arc-loadweakretained-release.m [new file with mode: 0644]
test/CodeGenObjC/arc.m
test/CodeGenObjCXX/arc.mm