summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-02-25 02:48:22 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-02-25 02:48:22 +0000
commit2495ab08fc79d42a3a7ee0200b6592cb80501056 (patch)
tree3a85207da44821e86ba5b90ae93db870d322bdd6 /clang/lib/Sema
parent335c5a42e9cfa70436bce30a6867cb722cac339c (diff)
downloadbcm5719-llvm-2495ab08fc79d42a3a7ee0200b6592cb80501056.tar.gz
bcm5719-llvm-2495ab08fc79d42a3a7ee0200b6592cb80501056.zip
Work-in-progress for lambda conversion-to-block operator. Still need to implement the retain+autorelease outside of ARC, and there's a bug that causes the generated code to crash in ARC (which I think is unrelated to my code, although I'm not completely sure).
llvm-svn: 151428
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index a2180be53c4..1f5255dae7f 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -8868,11 +8868,17 @@ void Sema::DefineImplicitLambdaToBlockPointerConversion(
}
Block->setParams(BlockParams);
- // Add capture. The capture is uses a fake (NULL) variable, since we don't
- // actually want to have to name a capture variable. However, the
- // initializer copy-initializes the lambda object.
- BlockDecl::Capture Capture(/*Variable=*/0, /*ByRef=*/false, /*Nested=*/false,
- /*Copy=*/Init.take());
+ // Add capture. The capture uses a fake variable, which doesn't correspond
+ // to any actual memory location. However, the initializer copy-initializes
+ // the lambda object.
+ TypeSourceInfo *CapVarTSI =
+ Context.getTrivialTypeSourceInfo(DerefThis->getType());
+ VarDecl *CapVar = VarDecl::Create(Context, Block, Conv->getLocation(),
+ Conv->getLocation(), 0,
+ DerefThis->getType(), CapVarTSI,
+ SC_None, SC_None);
+ BlockDecl::Capture Capture(/*Variable=*/CapVar, /*ByRef=*/false,
+ /*Nested=*/false, /*Copy=*/Init.take());
Block->setCaptures(Context, &Capture, &Capture + 1,
/*CapturesCXXThis=*/false);
OpenPOWER on IntegriCloud