[PATCH] [analyzer] Enable limited support for temporary destructors

Pavel Labath labath at google.com
Fri Aug 23 06:44:06 PDT 2013


  Oops, I'm no sure how I didn't notice that before but apparently lifetime extension sometimes produces completely broken CFGs. Something like this below manages to utterly confuse the analyzer. I think I remember looking at it and it seemed ok... :/

  I'll start looking into this, but do you think it would be possible to submit this without the "cfg-temporary-dtors = true" flag-flip. That way, it will not be enabled by default (so you can still claim that temporary dtors are unsupported), but anybody who wants to try it out, can give it a shot. Apart from lifetime extension, the change runs pretty reliably (I ran it over all of google code without encountering any hickups).

    struct A {
      A();
      ~A();
    };

    struct B : public A {
      B();
      ~B() __attribute__((noreturn));
    };

    int f(int *x) {
      {
        const A& a = B();
        if (x)
          return 1;
      }
      *x = 47;
    }

http://llvm-reviews.chandlerc.com/D1259



More information about the cfe-commits mailing list