[all-commits] [llvm/llvm-project] b3469c: [clang][Analysis] Handle && and || against variabl...

Takuya Shimizu via All-commits all-commits at lists.llvm.org
Thu Aug 17 01:56:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b3469ce6f80bce2b0a86026fd6867c4b04853466
      https://github.com/llvm/llvm-project/commit/b3469ce6f80bce2b0a86026fd6867c4b04853466
  Author: Takuya Shimizu <shimizu2486 at gmail.com>
  Date:   2023-08-17 (Thu, 17 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Analysis/CFG.h
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Analysis/CFG.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    M clang/test/Analysis/temp-obj-dtors-cfg-output.cpp
    M clang/test/Misc/warning-wall.c
    A clang/test/SemaCXX/tautological-negation-compare.cpp
    M clang/test/SemaCXX/warn-infinite-recursion.cpp

  Log Message:
  -----------
  [clang][Analysis] Handle && and || against variable and its negation as tautology

This patch introduces a new warning flag -Wtautological-negation-compare grouped in -Wtautological-compare that warns on the use of && or || operators against a variable and its negation.
e.g. x || !x and !x && x
This also makes the -Winfinite-recursion diagnose more cases.

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

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




More information about the All-commits mailing list