Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //===-- DebugSupport.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 functions which generate more readable forms of data
  10. //  structures used in the dataflow analyses, for debugging purposes.
  11. //
  12. //===----------------------------------------------------------------------===//
  13.  
  14. #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DEBUGSUPPORT_H_
  15. #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DEBUGSUPPORT_H_
  16.  
  17. #include <string>
  18. #include <vector>
  19.  
  20. #include "clang/Analysis/FlowSensitive/Solver.h"
  21. #include "clang/Analysis/FlowSensitive/Value.h"
  22. #include "llvm/ADT/DenseMap.h"
  23. #include "llvm/ADT/StringRef.h"
  24.  
  25. namespace clang {
  26. namespace dataflow {
  27.  
  28. /// Returns a string representation of a value kind.
  29. llvm::StringRef debugString(Value::Kind Kind);
  30.  
  31. /// Returns a string representation of a boolean assignment to true or false.
  32. llvm::StringRef debugString(Solver::Result::Assignment Assignment);
  33.  
  34. /// Returns a string representation of the result status of a SAT check.
  35. llvm::StringRef debugString(Solver::Result::Status Status);
  36.  
  37. /// Returns a string representation for the boolean value `B`.
  38. ///
  39. /// Atomic booleans appearing in the boolean value `B` are assigned to labels
  40. /// either specified in `AtomNames` or created by default rules as B0, B1, ...
  41. ///
  42. /// Requirements:
  43. ///
  44. ///   Names assigned to atoms should not be repeated in `AtomNames`.
  45. std::string debugString(
  46.     const BoolValue &B,
  47.     llvm::DenseMap<const AtomicBoolValue *, std::string> AtomNames = {{}});
  48.  
  49. /// Returns a string representation for `Constraints` - a collection of boolean
  50. /// formulas.
  51. ///
  52. /// Atomic booleans appearing in the boolean value `Constraints` are assigned to
  53. /// labels either specified in `AtomNames` or created by default rules as B0,
  54. /// B1, ...
  55. ///
  56. /// Requirements:
  57. ///
  58. ///   Names assigned to atoms should not be repeated in `AtomNames`.
  59. std::string debugString(
  60.     const llvm::DenseSet<BoolValue *> &Constraints,
  61.     llvm::DenseMap<const AtomicBoolValue *, std::string> AtomNames = {{}});
  62.  
  63. /// Returns a string representation for `Constraints` - a collection of boolean
  64. /// formulas and the `Result` of satisfiability checking.
  65. ///
  66. /// Atomic booleans appearing in `Constraints` and `Result` are assigned to
  67. /// labels either specified in `AtomNames` or created by default rules as B0,
  68. /// B1, ...
  69. ///
  70. /// Requirements:
  71. ///
  72. ///   Names assigned to atoms should not be repeated in `AtomNames`.
  73. std::string debugString(
  74.     ArrayRef<BoolValue *> Constraints, const Solver::Result &Result,
  75.     llvm::DenseMap<const AtomicBoolValue *, std::string> AtomNames = {{}});
  76. inline std::string debugString(
  77.     const llvm::DenseSet<BoolValue *> &Constraints,
  78.     const Solver::Result &Result,
  79.     llvm::DenseMap<const AtomicBoolValue *, std::string> AtomNames = {{}}) {
  80.   std::vector<BoolValue *> ConstraintsVec(Constraints.begin(),
  81.                                           Constraints.end());
  82.   return debugString(ConstraintsVec, Result, std::move(AtomNames));
  83. }
  84.  
  85. } // namespace dataflow
  86. } // namespace clang
  87.  
  88. #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DEBUGSUPPORT_H_
  89.