[PATCH] D122231: [clang][dataflow] Add support for `value_or` in a comparison.
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 23 09:28:55 PDT 2022
xazax.hun added inline comments.
================
Comment at: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp:269
+ // the implication `(opt.value_or(X) != X) => opt.hasValue()`.
+ State.Env.addToFlowCondition(
+ State.Env.makeImplication(*ComparisonExprValue, *HasValueVal));
----------------
There is an implication in the reverse direction as well. In case we know the optional is empty, we can prune one of the branches from the analysis. Is it possible to implement that with the current status of the framework?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122231/new/
https://reviews.llvm.org/D122231
More information about the cfe-commits
mailing list