diff options
author | John McCall <rjmccall@apple.com> | 2013-03-04 06:32:36 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-03-04 06:32:36 +0000 |
commit | 0353a7b2df9dc36784f9ec354c266f9c603053e1 (patch) | |
tree | a67cfe898ed57ba4e0285fc9fec106ad759603b6 /lib/CodeGen/CGBlocks.cpp | |
parent | 68f94dbbd20cf41af733f2036c8688894489c3fd (diff) |
Fix the emission of the copy-initialization of a block capture
from a lambda capture when the capture is not trivially-copyable.
rdar://13295759
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | lib/CodeGen/CGBlocks.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 23aa066dce..b9f466117c 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/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 |