JonasToth added a comment.

Short note here too: I think having `isModified` return a track record, like a 
vector for each

1. modifications
2. non-const handle taking
3. (const usages)

would be nice. Every user can decide how to react to it. Then the function 
would be more like `usageRecord` with pointers to each usage.
That allows graph building, it allows detailed diagnostics and contains all 
relevant information for the expr.

Other interesting cases we need to consider here:

1. casts -> all kinds of casts forbid kinda forbid constness.
2. rvalue references, modification happens for `std::move(v); std::forward(v); 
static_cast<T&&>(v)`
3. ternary operator
4. lambdas with local usage only
5. lambdas that escape, e.g. `int i; std::thread t([&](){ while(true) i++; });` 
Hard to analyze? I think we can consider all references into lambdas as escape

Maybe you can add an assertion about template types without concepts as a 
safeguard?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45679



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

Reply via email to