1 //===- WatchedLiteralsSolver.h ----------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file defines a SAT solver implementation that can be used by dataflow 10 // analyses. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_WATCHEDLITERALSSOLVER_H 15 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_WATCHEDLITERALSSOLVER_H 16 17 #include "clang/Analysis/FlowSensitive/Solver.h" 18 #include "clang/Analysis/FlowSensitive/Value.h" 19 #include "llvm/ADT/DenseSet.h" 20 21 namespace clang { 22 namespace dataflow { 23 24 /// A SAT solver that is an implementation of Algorithm D from Knuth's The Art 25 /// of Computer Programming Volume 4: Satisfiability, Fascicle 6. It is based on 26 /// the Davis-Putnam-Logemann-Loveland (DPLL) algorithm, keeps references to a 27 /// single "watched" literal per clause, and uses a set of "active" variables 28 /// for unit propagation. 29 class WatchedLiteralsSolver : public Solver { 30 public: 31 Result solve(llvm::DenseSet<BoolValue *> Vals) override; 32 }; 33 34 } // namespace dataflow 35 } // namespace clang 36 37 #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_WATCHEDLITERALSSOLVER_H 38