[all-commits] [llvm/llvm-project] 605a9a: [clang-tidy] fix false positive in modernize-min-m...

Julian Schmidt via All-commits all-commits at lists.llvm.org
Tue Sep 17 01:44:02 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 605a9adb4340b347f480a95a6eef3c9045e8416f
      https://github.com/llvm/llvm-project/commit/605a9adb4340b347f480a95a6eef3c9045e8416f
  Author: Julian Schmidt <git.julian.schmidt at gmail.com>
  Date:   2024-09-17 (Tue, 17 Sep 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/MinMaxUseInitializerListCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/modernize/min-max-use-initializer-list.cpp

  Log Message:
  -----------
  [clang-tidy] fix false positive in modernize-min-max-use-initializer-list (#107649)

Previously, whenever a replacement was generated by the analysis, a
diagnostic was generated. This became an issue when a call to
`std::min` or `std::max` consisted only of an initializer list with at
least one argument to the list requiring a type cast.
In this case, a single replacement that added a `static_cast` was
created,
that resulted in a diagnostic being issued but with no nested call
to `std::min` or `std::max`.

Instead, explicitly track if a nested call was detected and only emit a
diagnostic if this is the case.

Fixes #107594



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list