[all-commits] [llvm/llvm-project] 2f02b5: [clang-tidy][modernize-use-starts-ends-with] Fix o...

Nicolas van Kempen via All-commits all-commits at lists.llvm.org
Wed Nov 27 09:03:32 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f02b5af6ecb973d3a7faad9b0daff22646e724d
      https://github.com/llvm/llvm-project/commit/2f02b5af6ecb973d3a7faad9b0daff22646e724d
  Author: Nicolas van Kempen <nvankemp at gmail.com>
  Date:   2024-11-27 (Wed, 27 Nov 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
    M clang-tools-extra/test/clang-tidy/checkers/modernize/use-starts-ends-with.cpp

  Log Message:
  -----------
  [clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative (#117837)

In C++20, `operator!=` can be rewritten by negating `operator==`. This
is the case for `std::string`, where `operator!=` is not provided hence
relying on this rewriting.

Cover this case by matching `binaryOperation` and adding one case to
`isNegativeComparison`.



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