danix800 added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:180-183
+      SVal CountReached =
+          SVB.evalBinOp(State, BO_GE, Idx, Count, ASTCtx.BoolTy);
+      if (!CountReached.isUndef() &&
+          State->assume(*CountReached.getAs<DefinedOrUnknownSVal>(), true))
----------------
donat.nagy wrote:
> I think checking the nullness of `getAs()` is more elegant than using a 
> separate `isUndef()` check.
> 
> On a longer term / as a separate improvement, I'd also think about allowing 
> `UndefinedVal` as the argument of the `assert()`-like functions, because the 
> `evalBinOp` -> `assert` combination is very common in checkers and IIRC in 
> most checkers the branch of `UndefinedVal` will produce the same result as 
> `UnknownVal`.
Thanks for the advice!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158707/new/

https://reviews.llvm.org/D158707

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

Reply via email to