1 //== SMTExpr.h --------------------------------------------------*- C++ -*--==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines a SMT generic Expr API, which will be the base class
11 // for every SMT solver expr specific class.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SMTEXPR_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SMTEXPR_H
18 #include "clang/Basic/TargetInfo.h"
19 #include "llvm/ADT/FoldingSet.h"
24 /// Generic base class for SMT exprs
28 virtual ~SMTExpr() = default;
30 bool operator<(const SMTExpr &Other) const {
31 llvm::FoldingSetNodeID ID1, ID2;
37 virtual void Profile(llvm::FoldingSetNodeID &ID) const {
42 friend bool operator==(SMTExpr const &LHS, SMTExpr const &RHS) {
43 return LHS.equal_to(RHS);
46 virtual void print(raw_ostream &OS) const = 0;
48 LLVM_DUMP_METHOD void dump() const { print(llvm::errs()); }
51 /// Query the SMT solver and returns true if two sorts are equal (same kind
52 /// and bit width). This does not check if the two sorts are the same objects.
53 virtual bool equal_to(SMTExpr const &other) const = 0;
56 /// Shared pointer for SMTExprs, used by SMTSolver API.
57 using SMTExprRef = std::shared_ptr<SMTExpr>;