diff options
| author | Akira Hatanaka <ahatanaka@apple.com> | 2019-11-29 09:56:02 -0800 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@apple.com> | 2019-12-03 23:44:30 -0800 |
| commit | d8136f14f125fb27f2326f397df0964bf62078ca (patch) | |
| tree | e927eb6aa7e29cdaa30c2b90dab6258fc22ffae1 /clang/lib/CodeGen/CGCall.cpp | |
| parent | d08dc0655e74d5c226789e1a2378c7c215ee7297 (diff) | |
| download | bcm5719-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/CGCall.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index f992f904fe7..ca6b1d409c2 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1047,8 +1047,13 @@ void CodeGenFunction::ExpandTypeFromArgs( auto imagValue = *AI++; EmitStoreOfComplex(ComplexPairTy(realValue, imagValue), LV, /*init*/ true); } else { + // Call EmitStoreOfScalar except when the lvalue is a bitfield to emit a + // primitive store. assert(isa<NoExpansion>(Exp.get())); - EmitStoreThroughLValue(RValue::get(*AI++), LV); + if (LV.isBitField()) + EmitStoreThroughLValue(RValue::get(*AI++), LV); + else + EmitStoreOfScalar(*AI++, LV); } } |

