13#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SYMEXPR_H
14#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SYMEXPR_H
18#include "llvm/ADT/FoldingSet.h"
19#include "llvm/ADT/SmallVector.h"
20#include "llvm/ADT/iterator_range.h"
21#include "llvm/Support/Compiler.h"
33class SymExpr :
public llvm::FoldingSetNode {
34 virtual void anchor();
38#define SYMBOL(Id, Parent) Id##Kind,
39#define SYMBOL_RANGE(Id, First, Last) BEGIN_##Id = First, END_##Id = Last,
40#include "clang/StaticAnalyzer/Core/PathSensitive/Symbols.def"
61 return !
T.isNull() && !
T->isVoidType();
68 LLVM_PREFERRED_TYPE(
Kind)
84 virtual void dump()
const;
89 virtual void Profile(llvm::FoldingSetNodeID &profile) = 0;
102 void expand(
const SymExpr *SE);
103 bool atEnd()
const {
return !WL || WL->empty(); }
112 assert(!atEnd() &&
"attempting to dereference an 'end' iterator");
117 return atEnd() ==
X.atEnd();
129 Worklist.push_back(Root);
172 void anchor()
override;
190 return K >= BEGIN_SYMBOLS && K <= END_SYMBOLS;
195 assert(!atEnd() &&
"attempting to iterate on an 'end' iterator");
196 const SymExpr *SE = WL->pop_back_val();
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
C Language Family Type Representation.
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
Iterator over symbols that the current symbol depends on.
bool operator==(const symbol_iterator &X) const
const SymExpr * operator*() const
symbol_iterator & operator++()
symbol_iterator()=default
symbol_iterator(SmallVectorImpl< const SymExpr * > *WL)
bool operator!=(const symbol_iterator &X) const
A single-pass range of symbol_iterator that owns the worklist.
symbol_range & operator=(symbol_range &&)=delete
symbol_range(const symbol_range &)=delete
symbol_range & operator=(const symbol_range &)=delete
symbol_range(symbol_range &&)=delete
symbol_range(const SymExpr *Root)
symbol_iterator begin() LLVM_LIFETIME_BOUND
virtual void dumpToStream(raw_ostream &os) const
static bool isValidTypeForSymbol(QualType T)
virtual void Profile(llvm::FoldingSetNodeID &profile)=0
virtual const MemRegion * getOriginRegion() const
Find the region from which this symbol originates.
SymExpr(Kind k, SymbolID Sym)
virtual QualType getType() const =0
symbol_range symbols() const
virtual unsigned computeComplexity() const =0
virtual ~SymExpr()=default
virtual void dump() const
SymbolID getSymbolID() const
Get a unique identifier for this symbol.
virtual StringRef getKindStr() const =0
Get a string representation of the kind of the region.
static constexpr bool classof(Kind K)
unsigned computeComplexity() const override
~SymbolData() override=default
static bool classof(const SymExpr *SE)
SymbolData(Kind k, SymbolID sym)
SmallVector< SymbolRef, 2 > SymbolRefSmallVectorTy
const SymExpr * SymbolRef
raw_ostream & operator<<(raw_ostream &os, const MemRegion *R)
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
const FunctionProtoType * T
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 unsigned