diff options
author | Timm Bäder <tbaeder@redhat.com> | 2023-08-09 14:27:46 +0200 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2023-08-09 15:48:50 +0200 |
commit | f6ee4e3f5562acfb11f3c36f555e37246aaeefea (patch) | |
tree | bae2c0b175cdbe97686beb5502738b5d129389ba /clang/lib/AST/ExprConstant.cpp | |
parent | 860d38bf57470de2b94ffec1cfe2c7d7e65fbbdc (diff) | |
download | llvm-f6ee4e3f5562acfb11f3c36f555e37246aaeefea.zip llvm-f6ee4e3f5562acfb11f3c36f555e37246aaeefea.tar.gz llvm-f6ee4e3f5562acfb11f3c36f555e37246aaeefea.tar.bz2 |
[clang][ExprConst] Add RHS source range to div by zero diags
Differential Revision: https://reviews.llvm.org/D157074
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 7d6796d..a7e0d5a 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2805,9 +2805,9 @@ static bool CheckedIntArithmetic(EvalInfo &Info, const Expr *E, } /// Perform the given binary integer operation. -static bool handleIntIntBinOp(EvalInfo &Info, const Expr *E, const APSInt &LHS, - BinaryOperatorKind Opcode, APSInt RHS, - APSInt &Result) { +static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E, + const APSInt &LHS, BinaryOperatorKind Opcode, + APSInt RHS, APSInt &Result) { bool HandleOverflowResult = true; switch (Opcode) { default: @@ -2828,7 +2828,8 @@ static bool handleIntIntBinOp(EvalInfo &Info, const Expr *E, const APSInt &LHS, case BO_Div: case BO_Rem: if (RHS == 0) { - Info.FFDiag(E, diag::note_expr_divide_by_zero); + Info.FFDiag(E, diag::note_expr_divide_by_zero) + << E->getRHS()->getSourceRange(); return false; } // Check for overflow case: INT_MIN / -1 or INT_MIN % -1. APSInt supports |