summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2013-03-04 06:32:36 +0000
committerJohn McCall <rjmccall@apple.com>2013-03-04 06:32:36 +0000
commita37c2fa40966b75624a524913bddfc4ea669bb46 (patch)
treeb4e66fa2dbfdca72ff3a345d4e062b53a669d692 /clang/lib/CodeGen/CGBlocks.cpp
parent7b0ae11c8265f6d42bbdd02eacd1c8c07cb2fcc5 (diff)
downloadbcm5719-llvm-a37c2fa40966b75624a524913bddfc4ea669bb46.tar.gz
bcm5719-llvm-a37c2fa40966b75624a524913bddfc4ea669bb46.zip
Fix the emission of the copy-initialization of a block capture
from a lambda capture when the capture is not trivially-copyable. rdar://13295759 llvm-svn: 176431
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 23aa066dcea..b9f466117c6 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -777,8 +777,16 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
// special; we'll simply emit it directly.
src = 0;
} else {
- // This is a [[type]]*.
- src = LocalDeclMap[variable];
+ // Just look it up in the locals map, which will give us back a
+ // [[type]]*. If that doesn't work, do the more elaborate DRE
+ // emission.
+ src = LocalDeclMap.lookup(variable);
+ if (!src) {
+ DeclRefExpr declRef(const_cast<VarDecl*>(variable),
+ /*refersToEnclosing*/ ci->isNested(), type,
+ VK_LValue, SourceLocation());
+ src = EmitDeclRefLValue(&declRef).getAddress();
+ }
}
// For byrefs, we just write the pointer to the byref struct into
OpenPOWER on IntegriCloud