[PATCH] D73007: [Sema] Avoid Wrange-loop-analysis false positives

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 25 11:44:03 PST 2020


aaron.ballman added a comment.

In D73007#1839648 <https://reviews.llvm.org/D73007#1839648>, @aaronpuchert wrote:

> Here is a proposal: we add two children to `-Wrange-loop-analysis`.
>
> - `-Wrange-loop-construct` warns about possibly unintended constructor calls. This might be in `-Wall`. It contains
>   - `warn_for_range_copy`: loop variable A of type B creates a copy from type C
>   - `warn_for_range_const_reference_copy`: loop variable A  is initialized with a value of a different type resulting in a copy
> - `-Wrange-loop-bind-ref[erence]` warns about misleading use of reference types. This might **not** be in `-Wall`. It contains
>   - `warn_for_range_variable_always_copy`: loop variable A is always a copy because the range of type B does not return a reference


I think this seems like a reasonable approach.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73007





More information about the cfe-commits mailing list