WatchedLiteralsSolver.h 1.6 KB

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