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 | b1e3f324b0c4d17399609c246918dadcb886d739 (patch) | |
tree | 083ad3a77ddbf479b1045ac60c5e7fcc68866348 /lib/CodeGen/CGExprAgg.cpp | |
parent | ac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa (diff) |
Make sure null initialization in arrays works correctly with ARC types. <rdar://problem/10907547>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 5fb334bd8e..80d754a98a 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/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 |