AaronBallman wrote:

> > I question if -Wloop-analysis should be completely rewritten using dataflow 
> > analysis, rather than AST based matching.
> 
> should changes inside functions be handled in the following cases?
> 
> https://github.com/llvm/llvm-project/blob/db0f754c5af8e6c96770533520bf8b17fc0dc977/clang/test/SemaCXX/warn-loop-analysis.cpp#L23
> 
> https://github.com/llvm/llvm-project/blob/db0f754c5af8e6c96770533520bf8b17fc0dc977/clang/test/SemaCXX/warn-loop-analysis.cpp#L8
> 
> > rewritten using dataflow analysis
> 
> [`ExprMutationAnalyzer`](https://github.com/llvm/llvm-project/blob/main/clang/lib/Analysis/ExprMutationAnalyzer.cpp)?
> 
> /cc @AaronBallman @zyn0217 @cor3ntin

Oh that's a fun case. I think the behavior of that test makes sense if there 
was no definition for `by_ref` because we'd want to assume the non-`const` 
reference parameter is modified. But because we can see the definition for 
`by_ref`, we know the body is empty and so the variable is not modified, and so 
issuing the diagnostic there would be reasonable. WDYT?

https://github.com/llvm/llvm-project/pull/135573
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to