[all-commits] [llvm/llvm-project] cd4024: [clang-tidy] Fix false positive on ArrayInitIndexE...

isuckatcs via All-commits all-commits at lists.llvm.org
Tue Aug 30 11:28:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd40245f549b8bd7a5b6571c2eb6a882ce59acc9
      https://github.com/llvm/llvm-project/commit/cd40245f549b8bd7a5b6571c2eb6a882ce59acc9
  Author: isuckatcs <65320245+isuckatcs at users.noreply.github.com>
  Date:   2022-08-30 (Tue, 30 Aug 2022)

  Changed paths:
    M clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-bounds-constant-array-index.cpp

  Log Message:
  -----------
  [clang-tidy] Fix false positive on ArrayInitIndexExpr inside ProBoundsConstantArrayIndexCheck

Sometimes in the AST we can have an ArraySubscriptExpr,
where the index is an ArrayInitIndexExpr.
ArrayInitIndexExpr is not a constant, so
ProBoundsConstantArrayIndexCheck reports a warning when
it sees such expression. This expression can only be
implicitly generated, and always appears inside an
ArrayInitLoopExpr, so we shouldn't report a warning.

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




More information about the All-commits mailing list