filcab added a comment.

Minor nits, now.
LGTM, but having someone more familiar with clang chime in would be great.



================
Comment at: lib/CodeGen/CGExprScalar.cpp:1700
   case LangOptions::SOB_Trapping:
+    if (getUnwidenedIntegerType(CGF.getContext(), E->getSubExpr()).hasValue())
+      return Builder.CreateNSWAdd(InVal, Amount, Name);
----------------
Maybe a helper `IsWidenedIntegerOp(...)` (or `IsOpWiderThanBaseType`or 
something) would make this (and others, like the first return of 
`getUnwidenedIntegerType`) easier to read?


================
Comment at: test/CodeGen/ubsan-promoted-arith.cpp:90
+
+// Note: -INT_MIN / -1 can overflow.
+//
----------------
Extra `-`. `INT_MIN/-1` is what you want. You already have a test above for 
`-INT_MIN` (which would overflow before the division.


https://reviews.llvm.org/D29369



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to