rjmccall added inline comments.

================
Comment at: lib/Sema/SemaChecking.cpp:8592
+  bool BadR = !RType->isIntegerType() || RType->isSignedIntegerType() ||
+              RHS->isKnownToHaveBooleanValue();
+
----------------
Please extract a function which computes this for an Expr* and then call it as 
part of the conditions below, e.g.:

  if (op == BO_LT && isNonBooleanUnsignedValue(E->getLHS()) && IsZero(S, 
E->getRHS()))


================
Comment at: lib/Sema/SemaChecking.cpp:8879
+  if (IsComparisonConstant)
     return AnalyzeImpConvsInComparison(S, E);
   
----------------
Part of the purpose of checking for signed comparisons up here is to avoid 
unnecessarily computing ranges for the operands when we aren't going to use 
them.  That's still something we want to avoid.  I think you just need to call 
CheckTrivialUnsignedComparison in this fallback case, at least when the 
comparison is not constant.

You should also rename CheckTrivialUnsignedComparison to something like 
CheckTautologicalComparison.


Repository:
  rL LLVM

https://reviews.llvm.org/D37565



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

Reply via email to