This will have the observable effect of making cleanups run sooner, right? Can you test for that?
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -fblocks If you aren't checking the IR, use -emit-llvm-only to avoid writing to stdout. However, IMO you should be checking the IR here. On Tue, Sep 16, 2014 at 3:56 PM, jahanian <[email protected]> wrote: > Hi John, > > This test case: > > id test_dict() > { > return @{ > @"a": [](){}, > @"b": [](){} > }; > } > > Crashes in IRGen because ExprWithCleanups for the dummy BlockDecl we use > to facilitate lambda to block conversion > is at the wrong place. > This happens because a lambda expression is considered a full expression > so it calls MaybeCreateExprWithCleanups > (see Sema::BuildBlockForLambdaConversion). > which ends up adding the clean up code for the BlockDecl of the first > lambda to the expression for the 2nd lambda! > > Ideally, MaybeCreateExprWithCleanups should be called when the entire > dictionary literal is seen. But in this case, > this does not happen. Attached patch fixes this by making sure that after > ‘every’ parse of the ‘value’ expression > MaybeCreateExprWithCleanups is called. This, in effect, assumes that the > ‘value’ literal is a full expression. > I don’t know the ramification of this change in the common case as couple > of non-lambda literal tests broke. > (it now generates the none-exc version of call instead of exc versions in > couple of places). > > Please review. Let me know if you need additional info. > > - Thanks, Fariborz > > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
