[all-commits] [llvm/llvm-project] a0d610: [Clang] Fix handling of Max from getValueRange(......

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Fri Jul 29 19:20:26 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0d61051628825e2f394240dc442ad5d81fa78bc
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2022-07-29 (Fri, 29 Jul 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticASTKinds.td
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp

  Log Message:
  [Clang] Fix handling of Max from getValueRange(...) in IntExprEvaluator::VisitCastExpr(...)

This is a follow-up to D130058 to fix how we handle the Max value we obtain from
getValueRange(...) in IntExprEvaluator::VisitCastExpr(...) which in the case of
an enum that contains an enumerator with the max integer value will overflow by

The fix is to decrement the value of Max and use slt and ult for comparison Vs
sle and ule.`

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

More information about the All-commits mailing list