dcoughlin accepted this revision.
dcoughlin added a comment.
This revision is now accepted and ready to land.

Sorry for the long delay! This looks good to me. Do you have commit access, or 
do you need someone to commit it for you?

> Regarding " I think it would also be good to (eventually) add CFGElements 
> marking when the storage duration for underlying storage ends.":
> From what I understand, this only differs from the end of lifetime in case of 
> objects with non-trivial destructors, where the lifetime ends before
> the destructor is called and the storage duration ends afterwards.
> In which case is this difference important to the static analyzer? Accessing 
> an object after its lifetime ended is already UB, so the static analyzer 
> could warn on this,
> even before the storage duration for underlying storage ends.

There a couple of cases where the difference between storage duration and 
lifetime could be important to the analyzer.  For example, you can end the 
lifetime of an object prematurely by calling its destructor explicitly. Then, 
you can later create a new object in its place with new -- but only if the 
storage is still around. So

    F f;
    f.~F();
  // lifetime of object in 'f' ends
    new (&f) F;
  // lifetime of new object in 'f' begins

is fine, but

  F *p;
  {
    F f;
    f.~F();
    p = &f;
  }
  new (p) F;

is not.


https://reviews.llvm.org/D15031



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D15031: CFG: Add CF... Devin Coughlin via Phabricator via cfe-commits

Reply via email to