Skip to content

Commit 66364e6

Browse files
authored
[clang][dataflow] Add reachedLimit() to the Solver interface. (llvm#91320)
We may want code to call this that doesn't know which specific solver implementation it is dealing with.
1 parent b22a6f1 commit 66364e6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/include/clang/Analysis/FlowSensitive/Solver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class Solver {
8787
///
8888
/// All elements in `Vals` must not be null.
8989
virtual Result solve(llvm::ArrayRef<const Formula *> Vals) = 0;
90+
91+
// Did the solver reach its resource limit?
92+
virtual bool reachedLimit() const = 0;
9093
};
9194

9295
llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Solver::Result &);

clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class WatchedLiteralsSolver : public Solver {
4848

4949
Result solve(llvm::ArrayRef<const Formula *> Vals) override;
5050

51-
// The solver reached its maximum number of iterations.
52-
bool reachedLimit() const { return MaxIterations == 0; }
51+
bool reachedLimit() const override { return MaxIterations == 0; }
5352
};
5453

5554
} // namespace dataflow

0 commit comments

Comments
 (0)