|
22 | 22 | #include "clang/Analysis/FlowSensitive/ControlFlowContext.h"
|
23 | 23 | #include "clang/Analysis/FlowSensitive/DataflowAnalysisContext.h"
|
24 | 24 | #include "clang/Analysis/FlowSensitive/DataflowLattice.h"
|
| 25 | +#include "clang/Analysis/FlowSensitive/Formula.h" |
25 | 26 | #include "clang/Analysis/FlowSensitive/Logger.h"
|
26 | 27 | #include "clang/Analysis/FlowSensitive/StorageLocation.h"
|
27 | 28 | #include "clang/Analysis/FlowSensitive/Value.h"
|
@@ -524,16 +525,30 @@ class Environment {
|
524 | 525 | arena().makeEquals(LHS.formula(), RHS.formula()));
|
525 | 526 | }
|
526 | 527 |
|
527 |
| - /// Returns the token that identifies the flow condition of the environment. |
| 528 | + /// Returns a boolean variable that identifies the flow condition (FC). |
| 529 | + /// |
| 530 | + /// The flow condition is a set of facts that are necessarily true when the |
| 531 | + /// program reaches the current point, expressed as boolean formulas. |
| 532 | + /// The flow condition token is equivalent to the AND of these facts. |
| 533 | + /// |
| 534 | + /// These may e.g. constrain the value of certain variables. A pointer |
| 535 | + /// variable may have a consistent modeled PointerValue throughout, but at a |
| 536 | + /// given point the Environment may tell us that the value must be non-null. |
| 537 | + /// |
| 538 | + /// The FC is necessary but not sufficient for this point to be reachable. |
| 539 | + /// In particular, where the FC token appears in flow conditions of successor |
| 540 | + /// environments, it means "point X may have been reached", not |
| 541 | + /// "point X was reached". |
528 | 542 | Atom getFlowConditionToken() const { return FlowConditionToken; }
|
529 | 543 |
|
530 |
| - /// Adds `Val` to the set of clauses that constitute the flow condition. |
| 544 | + /// Record a fact that must be true if this point in the program is reached. |
531 | 545 | void addToFlowCondition(const Formula &);
|
532 | 546 | /// Deprecated: Use Formula version instead.
|
533 | 547 | void addToFlowCondition(BoolValue &Val);
|
534 | 548 |
|
535 |
| - /// Returns true if and only if the clauses that constitute the flow condition |
536 |
| - /// imply that `Val` is true. |
| 549 | + /// Returns true if the formula is always true when this point is reached. |
| 550 | + /// Returns false if the formula may be false, or if the flow condition isn't |
| 551 | + /// sufficiently precise to prove that it is true. |
537 | 552 | bool flowConditionImplies(const Formula &) const;
|
538 | 553 | /// Deprecated: Use Formula version instead.
|
539 | 554 | bool flowConditionImplies(BoolValue &Val) const;
|
|
0 commit comments