[PATCH] D158707: [analyzer] Fix a few size-type signedness inconsistency related to DynamicExtent
Ding Fei via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 24 08:05:56 PDT 2023
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
More information about the cfe-commits
mailing list