Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes
PR12746 / <rdar://problem/11465120>.
llvm-svn: 156925
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index dad8e7e..47c6c48 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -698,7 +698,7 @@
// Compute the address of the thing we're going to move into the
// block literal.
llvm::Value *src;
- if (ci->isNested()) {
+ if (BlockInfo && ci->isNested()) {
// We need to use the capture from the enclosing block.
const CGBlockInfo::Capture &enclosingCapture =
BlockInfo->getCapture(variable);