diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-18 21:45:40 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-18 21:45:40 +0000 |
commit | f5125d19e7b466a76a5471286ad2e3d038f8cf86 (patch) | |
tree | f8ae6d433d36dfb4299001ab3cf4c38dcbe03cfd /clang/lib/CodeGen/CGExpr.cpp | |
parent | b5e867acff9807091eae51d383923c71c6acff05 (diff) | |
download | bcm5719-llvm-f5125d19e7b466a76a5471286ad2e3d038f8cf86.tar.gz bcm5719-llvm-f5125d19e7b466a76a5471286ad2e3d038f8cf86.zip |
Generate objc_read_weak for __weak objc loads.
llvm-svn: 59553
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 993562592b6..d537c9ca813 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -151,6 +151,14 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { /// this method emits the address of the lvalue, then loads the result as an /// rvalue, returning the rvalue. RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) { + if (LV.isObjcWeak()) { + // load of a __weak object. + llvm::Value *AddrWeakObj = LV.getAddress(); + llvm::Value *read_weak = CGM.getObjCRuntime().EmitObjCWeakCall(*this, + AddrWeakObj); + return RValue::get(read_weak); + } + if (LV.isSimple()) { llvm::Value *Ptr = LV.getAddress(); const llvm::Type *EltTy = |