[all-commits] [llvm/llvm-project] dfdfd3: [Clang] Fix -Wconstant-logical-operand when LHS is...

shivam-amd via All-commits all-commits at lists.llvm.org
Tue Jul 18 23:42:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dfdfd306cfaf54fbc43e2d5eb36489dac3eb9976
      https://github.com/llvm/llvm-project/commit/dfdfd306cfaf54fbc43e2d5eb36489dac3eb9976
  Author: Shivam Gupta <Shivam.Gupta2 at amd.com>
  Date:   2023-07-19 (Wed, 19 Jul 2023)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/C/drs/dr4xx.c
    M clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp
    M clang/test/Parser/cxx2a-concept-declaration.cpp
    M clang/test/Sema/exprs.c
    M clang/test/SemaCXX/expressions.cpp
    M clang/test/SemaCXX/warn-unsequenced.cpp
    M clang/test/SemaTemplate/dependent-expr.cpp

  Log Message:
  -----------
  [Clang] Fix -Wconstant-logical-operand when LHS is a constant

This fix PR37919

The below code produces -Wconstant-logical-operand for the first statement,
but not the second.

void foo(int x) {
if (x && 5) {}
if (5 && x) {}
}

Reviewed By: nickdesaulniers

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




More information about the All-commits mailing list