clang  16.0.0git
DebugSupport.h
Go to the documentation of this file.
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 
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.
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`.
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`.
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`.
74  ArrayRef<BoolValue *> Constraints, const Solver::Result &Result,
75  llvm::DenseMap<const AtomicBoolValue *, std::string> AtomNames = {{}});
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_
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::dataflow::Solver::Result::Status
Status
Definition: Solver.h:29
clang::prec::Assignment
@ Assignment
Definition: OperatorPrecedence.h:29
Solver.h
clang::dataflow::Value::Kind
Kind
Definition: Value.h:34
llvm::DenseSet
Definition: Sema.h:77
clang::dataflow::debugString
llvm::StringRef debugString(Value::Kind Kind)
Returns a string representation of a value kind.
Definition: DebugSupport.cpp:35
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::dataflow::Solver::Result::Assignment
Assignment
A boolean value is set to true or false in a truth assignment.
Definition: Solver.h:44
clang
Definition: CalledOnceCheck.h:17
clang::dataflow::Solver::Result
Definition: Solver.h:28
Value.h