[all-commits] [llvm/llvm-project] 5a8d09: [clang-tidy] Fix false positive for cppcoreguideli...

flovent via All-commits all-commits at lists.llvm.org
Wed Jul 2 07:41:45 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a8d096ae3443909bbcc87465653c15b58bc2e11
      https://github.com/llvm/llvm-project/commit/5a8d096ae3443909bbcc87465653c15b58bc2e11
  Author: flovent <flbven at protonmail.com>
  Date:   2025-07-02 (Wed, 02 Jul 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-pointer-arithmetic.cpp

  Log Message:
  -----------
  [clang-tidy] Fix false positive for cppcoreguidelines-pro-bounds-pointer-arithmetic (#127394)

this PR fixes #126424
for `ArraySubScriptExpr`, `hasBase` Matcher will get right operand when
it is not integer type, but is not for sure that left operand is integer
type. For the example code below `hasBase` will get `r` for the
Subsequent matching and causing false positive.
```
template <typename R>
int f(std::map<R*, int>& map, R* r) {
  return map[r];
}
```
so is needed to see if index is integer type to avoid this situation.



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