summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-11-18 21:45:40 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-11-18 21:45:40 +0000
commit6dc2317b59cb1180a59f6c283d96b7a5dfeb5307 (patch)
tree284b0854afd1d6f568597dc0ce725ac5737df6bb /lib/CodeGen/CGExpr.cpp
parent6d657c4809d9128be88705d32768de007b988212 (diff)
downloadclang-6dc2317b59cb1180a59f6c283d96b7a5dfeb5307.tar.gz
clang-6dc2317b59cb1180a59f6c283d96b7a5dfeb5307.tar.bz2
clang-6dc2317b59cb1180a59f6c283d96b7a5dfeb5307.tar.xz
Generate objc_read_weak for __weak objc loads.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59553 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 993562592b..d537c9ca81 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/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 =