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

Richard Smith richard at metafoo.co.uk
Tue Mar 26 17:32:19 PDT 2013


  > Should I also remove the non-Assign Xor check for now?

  Yes, sounds like a good idea. Other than that, this looks good to go. Thanks!


================
Comment at: lib/Sema/SemaChecking.cpp:5039-5040
@@ -4962,9 +5038,4 @@
 
-  if (SourceRange.Width > TargetRange.Width) {
-    // If the source is a constant, use a default-on diagnostic.
-    // TODO: this should happen for bitfield stores, too.
-    llvm::APSInt Value(32);
-    if (E->isIntegerConstantExpr(Value, S.Context)) {
-      if (S.SourceMgr.isInSystemMacro(CC))
-        return;
-
+  llvm::APSInt Value(32);
+    Expr *NarrowedExpr = NULL;
+    // Use a default-on diagnostic if the source is involved in a
----------------
Some mysterious indentation has appeared here.


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



More information about the cfe-commits mailing list