This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG8bc13c884727: [clang][dataflow] Add `AnalysisInputs::withSolverFactory()`. (authored by mboehme).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154833/new/ 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);
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);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits