[all-commits] [llvm/llvm-project] c03349: [Sema] Remove a -Wrange warning from -Wall

mordante via All-commits all-commits at lists.llvm.org
Sat Feb 1 09:44:34 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c03349e40f21f0375278138992a32694a99c830e
      https://github.com/llvm/llvm-project/commit/c03349e40f21f0375278138992a32694a99c830e
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2020-02-01 (Sat, 01 Feb 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/test/Misc/warning-wall.c
    M clang/test/SemaCXX/warn-range-loop-analysis.cpp

  Log Message:
  -----------
  [Sema] Remove a -Wrange warning from -Wall

During the review of D73007 Aaron Puchert mentioned
`warn_for_range_variable_always_copy` shouldn't be part of -Wall since
some coding styles require `for(const auto &bar : bars)`. This warning
would cause false positives for these users. Based on Aaron's proposal
refactored the warnings:

* -Wrange-loop-construct warns about possibly unintended constructor
  calls. This is part of -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-reference warns about misleading use of reference
  types. This is not part of -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

Differential Revision: https://reviews.llvm.org/D73434




More information about the All-commits mailing list