[PATCH] D33563: Track whether a unary operation can overflow
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 2 14:59:33 PST 2018
efriedma added inline comments.
================
Comment at: include/clang/AST/Expr.h:1728
+ UnaryOperator(Expr *input, Opcode opc, QualType type, ExprValueKind VK,
+ ExprObjectKind OK, SourceLocation l, bool CanOverflow = false)
+ : Expr(UnaryOperatorClass, type, VK, OK,
----------------
Is the default argument necessary here? Better to avoid when possible.
================
Comment at: lib/Sema/SemaExpr.cpp:12212
case UO_Minus:
+ CanOverflow = isOverflowingIntegerType(Context, Input.get()->getType());
Input = UsualUnaryConversions(Input.get());
----------------
UO_Plus can't overflow.
================
Comment at: test/Misc/ast-dump-stmt.c:66
+ // CHECK: ImplicitCastExpr
+ // CHECK: DeclRefExpr{{.*}}'T2' 'int'
+}
----------------
What does it mean for bitwise complement to "overflow"?
https://reviews.llvm.org/D33563
More information about the cfe-commits
mailing list