aaron.ballman accepted this revision.
aaron.ballman added a comment.
LGTM aside from a simple refactoring (feel free to apply it when landing or do
it post-commit as an NFC change).
================
Comment at: clang/lib/AST/Interp/Interp.h:203-211
+ if (LHS.isSigned() && LHS.isMin() && RHS.isNegative() && RHS.isMinusOne()) {
+ APSInt LHSInt = LHS.toAPSInt();
+ SmallString<32> Trunc;
+ (-LHSInt.extend(LHSInt.getBitWidth() + 1)).toString(Trunc, 10);
+ const SourceInfo &Loc = S.Current->getSource(OpPC);
+ const Expr *E = S.Current->getExpr(OpPC);
+ S.CCEDiag(Loc, diag::note_constexpr_overflow) << Trunc << E->getType();
----------------
We should factor this out into a helper function so we don't have duplication
between Div and Rem. Same for the above block checking for division by zero.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134749/new/
https://reviews.llvm.org/D134749
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits