[clang] [analyzer][NFC] Trivial cleanup in ArrayBoundChecker (PR #126941)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 08:36:03 PST 2025


================
@@ -394,14 +394,13 @@ static bool tryDividePair(std::optional<int64_t> &Val1,
     return false;
   const bool Val1HasRemainder = Val1 && *Val1 % Divisor;
   const bool Val2HasRemainder = Val2 && *Val2 % Divisor;
-  if (!Val1HasRemainder && !Val2HasRemainder) {
-    if (Val1)
-      *Val1 /= Divisor;
-    if (Val2)
-      *Val2 /= Divisor;
-    return true;
-  }
-  return false;
+  if (Val1HasRemainder || Val2HasRemainder)
+    return false;
----------------
NagyDonat wrote:

I thought about removing these boolean variables (and introducing two separate early return paths for `Val1` and `Val2`), but their names seem to be useful for documenting this logic.

https://github.com/llvm/llvm-project/pull/126941


More information about the cfe-commits mailing list