[PATCH] D46421: [analyzer][CrossTU] Extend CTU to VarDecls with initializer

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 14 12:02:35 PST 2018


NoQ added a comment.

In D46421#1121080 <https://reviews.llvm.org/D46421#1121080>, @r.stahl wrote:

> It seems like a good idea to not do that, since non-const values are not used. It might become useful if we ever do some kind of straight line execution from static initialization to main.
>  However for structs it is enough if one of their fields is declared const.


Aaand in C++ there's also the `mutable` keyword that can cancel the effect of the surrounding `const` keyword, at least for the purposes of precise memory contents modeling in `RegionStore`.

The idea looks great to me. It was far from obvious to me that importing variables manually was necessary, nice catch.

I definitely wish for a more direct test for this, i.e. "CTU analysis avoids that specific false positive due to the new functionality".


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D46421/new/

https://reviews.llvm.org/D46421





More information about the cfe-commits mailing list