[PATCH] Fix some cases of incorrect handling of lifetime extended temporaries.

Manuel Klimek klimek at google.com
Wed Jul 30 00:17:33 PDT 2014


On Wed, Jul 30, 2014 at 4:37 AM, Jordan Rose <jordan_rose at apple.com> wrote:

> Can you add a test for the subobject case too, even though that doesn't
> work yet either?
>
>     const LifetimeExtend &ref = Aggregate{ 0, 1 }.a;
>     6;
>     // expect ~Aggregate here rather than ~LifetimeExtend
>

Unfortunately, I can't add the test - the problem is that this currently
crashes - my other patch will fix this (with tests :)


> Other than that, this seems like a fine incremental improvement.
>
> ================
> Comment at: test/Analysis/cfg.cpp:421-429
> @@ +420,11 @@
> +  }
> +  // CHECK: LifetimeExtend(5)
> +  // CHECK-NEXT: : 5
> +  // FIXME: We want to emit the destructors of the lifetime
> +  // extended variables here.
> +  // CHECK-NOT: ~LifetimeExtend()
> +  {
> +    AggregateRef a{LifetimeExtend(5), LifetimeExtend(5)};
> +    5;
> +  }
> +  // FIXME: Add tests for lifetime extension via subobject
> ----------------
> I did not realize this worked. Huh. That's going to be fun.
>

My other patch also addresses this problem (it's not actually that much of
a problem, we just can't use the VarDecl as anchor any more).


>
> http://reviews.llvm.org/D4696
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140730/0a17054e/attachment.html>


More information about the cfe-commits mailing list