[PATCH] Add a truncation warning for values under a bitwise or

Richard Smith richard at metafoo.co.uk
Fri Feb 15 13:41:46 PST 2013


  Looks fine as far as it goes. There are a few other cases it'd be nice to generalize this to: add, multiply, xor, LHS of left shift. Also RHS of comma -- but it would be better to use EvaluateAsInt(..., SE_AllowSideEffects) instead of isIntegerConstantExpr to look at anything we can constant fold.


================
Comment at: lib/Sema/SemaChecking.cpp:5137
@@ +5136,3 @@
+    // This CheckImplicitConversion would trigger on NULLs, though their
+    // warnings should be trigger elsewhere. We filter those out here.
+    if (CAO->getOpcode() == BO_OrAssign && LHST != T &&
----------------
Typo: 'be trigger'. Also, instead of 'elsewhere', maybe more directly reference the check in CheckImplicitConversion for this?


http://llvm-reviews.chandlerc.com/D405



More information about the cfe-commits mailing list