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

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 4 02:32:33 PDT 2023


cor3ntin 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;
----------------
Why not just use ` E->getRHS()->getSourceRange()` here? It avoids an extra param


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157074



More information about the cfe-commits mailing list