[all-commits] [llvm/llvm-project] fd874e: Missing tautological compare warnings due to unary...

Muhammad Usman Shahid via All-commits all-commits at lists.llvm.org
Fri Aug 19 07:48:17 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fd874e5fb119e1d9f427a299ffa5bbabaeba9455
      https://github.com/llvm/llvm-project/commit/fd874e5fb119e1d9f427a299ffa5bbabaeba9455
  Author: Muhammad Usman Shahid <codesbyusman at gmail.com>
  Date:   2022-08-19 (Fri, 19 Aug 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Analysis/CFG.cpp
    M clang/test/Sema/warn-bitwise-compare.c
    M clang/test/SemaCXX/warn-bitwise-compare.cpp
    M clang/test/SemaCXX/warn-unreachable.cpp

  Log Message:
  -----------
  Missing tautological compare warnings due to unary operators

The patch mainly focuses on the no warnings for -Wtautological-compare.
It work fine for the positive numbers but doesn't for the negative
numbers. This is because the warning explicitly checks for an
IntegerLiteral AST node, but -1 is represented by a UnaryOperator with
an IntegerLiteral sub-Expr.

Fixes #42918
Differential Revision: https://reviews.llvm.org/D130510




More information about the All-commits mailing list