14#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALVISITOR_H
15#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALVISITOR_H
27template <
typename ImplClass,
typename RetTy =
void>
class SValVisitor {
28 ImplClass &derived() {
return *
static_cast<ImplClass *
>(
this); }
33 switch (
V.getKind()) {
34#define BASIC_SVAL(Id, Parent) \
35 case SVal::Id##Kind: \
36 return derived().Visit##Id(V.castAs<Id>());
37#define LOC_SVAL(Id, Parent) \
38 case SVal::Loc##Id##Kind: \
39 return derived().Visit##Id(V.castAs<loc::Id>());
40#define NONLOC_SVAL(Id, Parent) \
41 case SVal::NonLoc##Id##Kind: \
42 return derived().Visit##Id(V.castAs<nonloc::Id>());
43#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
45 llvm_unreachable(
"Unknown SVal kind!");
49#define BASIC_SVAL(Id, Parent) \
50 RetTy Visit##Id(Id V) { return derived().Visit##Parent(V.castAs<Id>()); }
51#define ABSTRACT_SVAL(Id, Parent) BASIC_SVAL(Id, Parent)
52#define LOC_SVAL(Id, Parent) \
53 RetTy Visit##Id(loc::Id V) { return derived().VisitLoc(V.castAs<Loc>()); }
54#define NONLOC_SVAL(Id, Parent) \
55 RetTy Visit##Id(nonloc::Id V) { \
56 return derived().VisitNonLoc(V.castAs<NonLoc>()); \
58#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def"
69#define DISPATCH(CLASS) \
70 return static_cast<ImplClass *>(this)->Visit ## CLASS(cast<CLASS>(S))
74 switch (S->getKind()) {
75#define SYMBOL(Id, Parent) \
76 case SymExpr::Id ## Kind: DISPATCH(Id);
77#include "clang/StaticAnalyzer/Core/PathSensitive/Symbols.def"
79 llvm_unreachable(
"Unknown SymExpr kind!");
84#define SYMBOL(Id, Parent) RetTy Visit ## Id(const Id *S) { DISPATCH(Parent); }
85#define ABSTRACT_SYMBOL(Id, Parent) SYMBOL(Id, Parent)
86#include "clang/StaticAnalyzer/Core/PathSensitive/Symbols.def"
99#define DISPATCH(CLASS) \
100 return static_cast<ImplClass *>(this)->Visit ## CLASS(cast<CLASS>(R))
105#define REGION(Id, Parent) case MemRegion::Id ## Kind: DISPATCH(Id);
106#include "clang/StaticAnalyzer/Core/PathSensitive/Regions.def"
108 llvm_unreachable(
"Unknown MemRegion kind!");
113#define REGION(Id, Parent) \
114 RetTy Visit ## Id(const Id *R) { DISPATCH(Parent); }
115#define ABSTRACT_REGION(Id, Parent) \
117#include "clang/StaticAnalyzer/Core/PathSensitive/Regions.def"
127template <
typename ImplClass,
typename RetTy =
void>
FullSValVisitor - a convenient mixed visitor for all three: SVal, SymExpr and MemRegion subclasses.
MemRegionVisitor - this class implements a simple visitor for MemRegion subclasses.
RetTy Visit(const MemRegion *R)
RetTy VisitMemRegion(const MemRegion *R)
MemRegion - The root abstract class for all memory regions.
SValVisitor - this class implements a simple visitor for SVal subclasses.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
SymExprVisitor - this class implements a simple visitor for SymExpr subclasses.
RetTy VisitSymExpr(SymbolRef S)
The JSON file list parser is used to communicate input to InstallAPI.