diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-02-22 05:38:59 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-02-22 05:38:59 +0000 |
| commit | 91d5bb1ee5e795dbad776856188f60a195d05d5a (patch) | |
| tree | 633093d86ee27f1932ebc86fca5b755e4c90504d /clang/lib | |
| parent | 3cd25390e5737111d3143572c5ba377f9dc91258 (diff) | |
| download | bcm5719-llvm-91d5bb1ee5e795dbad776856188f60a195d05d5a.tar.gz bcm5719-llvm-91d5bb1ee5e795dbad776856188f60a195d05d5a.zip | |
Make sure null initialization in arrays works correctly with ARC types. <rdar://problem/10907547>.
llvm-svn: 151133
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 5fb334bd8e8..80d754a98a4 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -853,9 +853,14 @@ void AggExprEmitter::EmitNullInitializationToLValue(LValue lv) { return; if (!CGF.hasAggregateLLVMType(type)) { - // For non-aggregates, we can store zero + // For non-aggregates, we can store zero. llvm::Value *null = llvm::Constant::getNullValue(CGF.ConvertType(type)); - CGF.EmitStoreThroughLValue(RValue::get(null), lv); + // Note that the following is not equivalent to + // EmitStoreThroughBitfieldLValue for ARC types. + if (lv.isBitField()) + CGF.EmitStoreThroughBitfieldLValue(RValue::get(null), lv); + assert(lv.isSimple()); + CGF.EmitStoreOfScalar(null, lv, /* isInitialization */ true); } else { // There's a potential optimization opportunity in combining // memsets; that would be easy for arrays, but relatively |

