summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2019-11-29 09:56:02 -0800
committerAkira Hatanaka <ahatanaka@apple.com>2019-12-03 23:44:30 -0800
commitd8136f14f125fb27f2326f397df0964bf62078ca (patch)
treee927eb6aa7e29cdaa30c2b90dab6258fc22ffae1 /clang/lib/CodeGen/CGExpr.cpp
parentd08dc0655e74d5c226789e1a2378c7c215ee7297 (diff)
downloadbcm5719-llvm-d8136f14f125fb27f2326f397df0964bf62078ca.tar.gz
bcm5719-llvm-d8136f14f125fb27f2326f397df0964bf62078ca.zip
[CodeGen][ObjC] Emit a primitive store to store a __strong field in
ExpandTypeFromArgs This fixes a bug in IRGen where a call to `llvm.objc.storeStrong` was being emitted to initialize a __strong field of an uninitialized temporary struct, which caused crashes at runtime. rdar://problem/51807365
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 6e3a26e2c78..cd42faefab0 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -4544,7 +4544,11 @@ RValue CodeGenFunction::EmitRValueForField(LValue LV,
// don't load reference fields.
if (FD->getType()->isReferenceType())
return RValue::get(FieldLV.getPointer(*this));
- return EmitLoadOfLValue(FieldLV, Loc);
+ // Call EmitLoadOfScalar except when the lvalue is a bitfield to emit a
+ // primitive load.
+ if (FieldLV.isBitField())
+ return EmitLoadOfLValue(FieldLV, Loc);
+ return RValue::get(EmitLoadOfScalar(FieldLV, Loc));
}
llvm_unreachable("bad evaluation kind");
}
OpenPOWER on IntegriCloud