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

Jordan Rose jordan_rose at apple.com
Tue Jul 29 19:37:50 PDT 2014


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

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.

http://reviews.llvm.org/D4696






More information about the cfe-commits mailing list