[PATCH] D154833: [clang][dataflow] Add `AnalysisInputs::withSolverFactory()`.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 10 04:55:13 PDT 2023
mboehme created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a project: All.
mboehme requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154833
Files:
clang/unittests/Analysis/FlowSensitive/TestingSupport.h
Index: clang/unittests/Analysis/FlowSensitive/TestingSupport.h
===================================================================
--- clang/unittests/Analysis/FlowSensitive/TestingSupport.h
+++ clang/unittests/Analysis/FlowSensitive/TestingSupport.h
@@ -143,6 +143,12 @@
BuiltinOptions = std::move(Options);
return std::move(*this);
}
+ AnalysisInputs<AnalysisT> &&
+ withSolverFactory(std::function<std::unique_ptr<Solver>()> Factory) && {
+ assert(Factory);
+ SolverFactory = std::move(Factory);
+ return std::move(*this);
+ }
/// Required. Input code that is analyzed.
llvm::StringRef Code;
@@ -170,6 +176,10 @@
tooling::FileContentMappings ASTBuildVirtualMappedFiles = {};
/// Configuration options for the built-in model.
DataflowAnalysisContext::Options BuiltinOptions;
+ /// SAT solver factory.
+ std::function<std::unique_ptr<Solver>()> SolverFactory = [] {
+ return std::make_unique<WatchedLiteralsSolver>();
+ };
};
/// Returns assertions based on annotations that are present after statements in
@@ -248,7 +258,7 @@
auto &CFCtx = *MaybeCFCtx;
// Initialize states for running dataflow analysis.
- DataflowAnalysisContext DACtx(std::make_unique<WatchedLiteralsSolver>(),
+ DataflowAnalysisContext DACtx(AI.SolverFactory(),
{/*Opts=*/AI.BuiltinOptions});
Environment InitEnv(DACtx, *Target);
auto Analysis = AI.MakeAnalysis(Context, InitEnv);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154833.538582.patch
Type: text/x-patch
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230710/4ee5a780/attachment.bin>
More information about the cfe-commits
mailing list