summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2017-05-09 01:20:05 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2017-05-09 01:20:05 +0000
commit855d70cb67eb4fff11fe75a6539350712f946f46 (patch)
tree3c208f201c97646fed70ab0af1ba3f59014fc841 /clang/lib/CodeGen/CGBlocks.cpp
parentfe4ed9bd854d1230723568a8cc6289bf9da7fff7 (diff)
downloadbcm5719-llvm-855d70cb67eb4fff11fe75a6539350712f946f46.tar.gz
bcm5719-llvm-855d70cb67eb4fff11fe75a6539350712f946f46.zip
[CodeGen][ObjC] Emit @objc_retain at -O0 for variables captured by
blocks. r302270 made changes to avoid emitting clang.arc.use at -O0 and instead emit @objc_release. We also have to emit @objc_retain for the captured variable at -O0 to match the @objc_release instead of just storing the pointer to the capture field. llvm-svn: 302495
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 2b2a92dd601..2f7f43be924 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -878,7 +878,8 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
// If type is const-qualified, copy the value into the block field.
} else if (type.isConstQualified() &&
- type.getObjCLifetime() == Qualifiers::OCL_Strong) {
+ type.getObjCLifetime() == Qualifiers::OCL_Strong &&
+ CGM.getCodeGenOpts().OptimizationLevel != 0) {
llvm::Value *value = Builder.CreateLoad(src, "captured");
Builder.CreateStore(value, blockField);
OpenPOWER on IntegriCloud