[all-commits] [llvm/llvm-project] 2d149d: [clang-tidy] Fix crashes on `if consteval` in read...

Emilia Dreamer via All-commits all-commits at lists.llvm.org
Wed Oct 5 00:01:17 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d149d17f069e671e064a000cb038590f4fc5303
      https://github.com/llvm/llvm-project/commit/2d149d17f069e671e064a000cb038590f4fc5303
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
    M clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    A clang-tools-extra/test/clang-tidy/checkers/readability/braces-around-statements-consteval-if.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/simplify-bool-expr-cxx23.cpp

  Log Message:
  -----------
  [clang-tidy] Fix crashes on `if consteval` in readability checks

The `readability-braces-around-statements` check tries to look at the
closing parens of the if condition to determine where to insert braces,
however, "consteval if" statements don't have a condition, and always
have braces regardless, so the skip can be checked.

The `readability-simplify-boolean-expr` check looks at the condition
of the if statement to determine what could be simplified, but as
"consteval if" statements do not have a condition that could be
simplified, they can also be skipped here.

There may still be more checks that try to look at the conditions of
`if`s that aren't included here

Fixes https://github.com/llvm/llvm-project/issues/57568

Reviewed By: njames93, aaron.ballman

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




More information about the All-commits mailing list