[PATCH] D158601: [Clang] Always constant-evaluate operands of comparisons to nullptr

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 06:14:25 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:13312
+        !EvaluatePointer(E->getRHS(), Res, Info))
+      return false;
     return Success(CmpResult::Equal, E);
----------------
tbaeder wrote:
> I kinda expected the fix for this bug to simply //remove// a special case... does just falling through to the `DoAfter()` call not work?
Nope, EvaluateComparisonBinaryOperator does compute the result of the comparison. `DoAfter` only adjust the result.
Removing that block of codes lead to a whole bunch of test failures


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158601/new/

https://reviews.llvm.org/D158601



More information about the cfe-commits mailing list