Re: [PATCH] D13099: [Analyzer] Don’t invalidate CXXThis when conservatively evaluating const methods (PR 21606)

Sean Eveson via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 6 02:47:54 PDT 2015


seaneveson marked 6 inline comments as done.
seaneveson added a comment.

There is an issue where pointers to the object (this) should cause it to be invalidated, but don't since TK_PreserveContents has been set.

For example:

  class B;
  class A {
    B b;
    const foo();
  };
  class B {
    A *ptr_a;
  }
  
  A a;
  a.b.ptr_a = &a;
  a.foo();

The method foo might modify 'this' via the object b, but 'this' will not be invalidated as foo is const.

Again I'm not sure this is worth checking for, based on the assumption that a reasonable const method won't modify the relevant object. What do people think?


http://reviews.llvm.org/D13099





More information about the cfe-commits mailing list