[PATCH] D45679: [clang-tidy] Add a helper function isModified, that checks whether an expression is modified within a statement.

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 18 10:54:58 PDT 2018


JonasToth added a comment.

I was thinking about that too.

- We can extract all `DeclRefExpr` for the modifiying expressions and

add dependencies.

Such analysis is definitly interesting, but should maybe be added later.
Having an internal `Expr` : `Modified?` mapping would suffice, too. The
`isExprModified` will then first check if it is calculated and start
calculation if not found.

Am 18.04.2018 um 19:32 schrieb Eugene Zelenko via Phabricator:

> Eugene.Zelenko added a comment.
> 
> In https://reviews.llvm.org/D45679#1071116, @JonasToth wrote:
> 
>> You are doing a great job and i learn new stuff :)
>> 
>> - What do you think about having these functions in a class? Now, we need to recalculate and reanalyze the scope for every variable, multiple times (reference tracking). It would be nice to do it as lazy as possible and memorize the results. Especially addressing the use-case for the const-check, storing that a reference is not modified will save a lot of work = performance
> 
> It may be reasonable to have variables/data members dependencies graph and mark them as constant/non constant.
> 
> Repository:
> 
>   rCTE Clang Tools Extra
> 
> https://reviews.llvm.org/D45679


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45679





More information about the cfe-commits mailing list