[clang] [clang][dataflow] Add `reachedLimit()` to the `Solver` interface. (PR #91320)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 7 04:52:21 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-analysis
Author: None (martinboehme)
<details>
<summary>Changes</summary>
We may want code to call this that doesn't know which specific solver
implementation it is dealing with.
---
Full diff: https://github.com/llvm/llvm-project/pull/91320.diff
2 Files Affected:
- (modified) clang/include/clang/Analysis/FlowSensitive/Solver.h (+3)
- (modified) clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h (+1-2)
``````````diff
diff --git a/clang/include/clang/Analysis/FlowSensitive/Solver.h b/clang/include/clang/Analysis/FlowSensitive/Solver.h
index 079f6802f241e..6166a503ab413 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Solver.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Solver.h
@@ -87,6 +87,9 @@ class Solver {
///
/// All elements in `Vals` must not be null.
virtual Result solve(llvm::ArrayRef<const Formula *> Vals) = 0;
+
+ // Did the solver reach its resource limit?
+ virtual bool reachedLimit() const = 0;
};
llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Solver::Result &);
diff --git a/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h b/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h
index 5448eecf6d41a..b5cd7aa10fd7d 100644
--- a/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h
+++ b/clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h
@@ -48,8 +48,7 @@ class WatchedLiteralsSolver : public Solver {
Result solve(llvm::ArrayRef<const Formula *> Vals) override;
- // The solver reached its maximum number of iterations.
- bool reachedLimit() const { return MaxIterations == 0; }
+ bool reachedLimit() const override { return MaxIterations == 0; }
};
} // namespace dataflow
``````````
</details>
https://github.com/llvm/llvm-project/pull/91320
More information about the cfe-commits
mailing list