[PATCH] D157074: [clang][ExprConst] Add RHS source range to div by zero diags

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 4 02:40:03 PDT 2023


tbaeder marked an inline comment as done.
tbaeder added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:2835
     if (RHS == 0) {
-      Info.FFDiag(E, diag::note_expr_divide_by_zero);
+      Info.FFDiag(E, diag::note_expr_divide_by_zero) << RHSRange;
       return false;
----------------
cor3ntin wrote:
> Why not just use ` E->getRHS()->getSourceRange()` here? It avoids an extra param
I thought there are cases where `E` is not a `BinaryOperator`, but that was wrong, thanks.


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

https://reviews.llvm.org/D157074



More information about the cfe-commits mailing list