[clang][dataflow] Add `Environment::allows()`. (#70046)
commitd1f59544cf31488d84a2daff0020af2f8e366ed8
authormartinboehme <mboehme@google.com>
Wed, 25 Oct 2023 14:02:22 +0000 (25 16:02 +0200)
committerGitHub <noreply@github.com>
Wed, 25 Oct 2023 14:02:22 +0000 (25 16:02 +0200)
tree68bfeecf9388758c3ff2a9f6ea1a271546835f8d
parent00b7979946e55ae291dc3e57112d3e5e7892b547
[clang][dataflow] Add `Environment::allows()`. (#70046)

This allows querying whether, given the flow condition, a certain
formula still
has a solution (though it is not necessarily implied by the flow
condition, as
`flowConditionImplies()` would check).

This can be checked today, but only with a double negation, i.e. to
check
whether, given the flow condition, a formula F has a solution, you can
check
`!Env.flowConditionImplies(Arena.makeNot(F))`. The double negation makes
this
hard to reason about, and it would be nicer to have a way of directly
checking
this.

For consistency, this patch also renames `flowConditionImplies()` to
`proves()`;
the old name is kept around for compatibility but deprecated.
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp