seaneveson added a comment.

I've realized that the patch doesn't handle pointers correctly, since a const 
method can modify the memory pointed at by a member. While pointer members 
should not be invalidated by const methods (if they are not mutable), the 
memory they point to should still be invalidated. I'll address this in the next 
version.

Regarding ConstPointerEscape:

In http://reviews.llvm.org/D13099#253111, @zaks.anna wrote:

> The analyzer has a notion of ConstPointerEscape, see checkConstPointerEscape 
> callback.
>  All the pointers to const parameters are escaped this way. The 
> implementation for that is in CallEvent::invalidateRegions, right below the 
> code you've added:
>
>   ...
>
>
> I think we should const escape all non-mutable fields as well as 'this'.
>
> (A motivation behind this callback is that one can call delete on pointers of 
> const *void type.)


I think I understand, but to clarify:
The fields that shouldn't be invalidated should still be added to 
ValuesToInvalidate, but with 
RegionAndSymbolInvalidationTraits::TK_PreserveContents set. This will result in 
checkConstPointerEscape being called properly.

Is that correct?


http://reviews.llvm.org/D13099



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to