15 #ifndef LLVM_CLANG_ANALYSIS_PROGRAMPOINT_H
16 #define LLVM_CLANG_ANALYSIS_PROGRAMPOINT_H
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/FoldingSet.h"
22 #include "llvm/ADT/Optional.h"
23 #include "llvm/ADT/PointerIntPair.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/Support/Casting.h"
26 #include "llvm/Support/DataTypes.h"
33 class AnalysisDeclContext;
35 class LocationContext;
36 class ProgramPointTag;
67 llvm::PointerIntPair<const void *, 2, unsigned> Data2;
71 llvm::PointerIntPair<const LocationContext *, 2, unsigned> L;
73 llvm::PointerIntPair<const ProgramPointTag *, 2, unsigned> Tag;
82 Data2(nullptr, (((
unsigned) k) >> 0) & 0x3),
84 Tag(tag, (((
unsigned) k) >> 4) & 0x3) {
96 Data2(P2, (((
unsigned) k) >> 0) & 0x3),
98 Tag(tag, (((
unsigned) k) >> 4) & 0x3) {}
102 const void *
getData2()
const {
return Data2.getPointer(); }
103 void setData2(
const void *d) { Data2.setPointer(d); }
117 assert(T::isKind(*
this));
128 if (!T::isKind(*
this))
137 unsigned x = Tag.getInt();
156 return L.getPointer();
161 llvm::FoldingSetNodeID
ID;
163 return ID.ComputeHash();
167 return Data1 == RHS.Data1 &&
168 Data2 == RHS.Data2 &&
174 return Data1 != RHS.Data1 ||
175 Data2 != RHS.Data2 ||
181 ID.AddInteger((
unsigned)
getKind());
198 assert(B &&
"BlockEntrance requires non-null block");
249 template <
typename T>
257 unsigned k = Location.
getKind();
266 const Stmt *SubStmt =
nullptr)
298 unsigned k = Location.
getKind();
328 unsigned k = location.
getKind();
452 assert(B1 &&
"BlockEdge: source block must be non-null");
453 assert(B2 &&
"BlockEdge: destination block must be non-null");
632 const void *Data2 =
nullptr,
701 struct isPodLike<clang::ProgramPoint> {
static const bool value =
true; };
static unsigned getHashValue(const clang::ProgramPoint &Loc)
PreLoad(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
static clang::ProgramPoint getTombstoneKey()
const CFGBlock * getBlock() const
ProgramPointTag(void *tagKind=nullptr)
const StackFrameContext * getCalleeContext() const
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
BlockEdge(const CFGBlock *B1, const CFGBlock *B2, const LocationContext *L)
PreStmt(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag, const Stmt *SubStmt=nullptr)
PostLValue(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
bool operator!=(const ProgramPoint &RHS) const
const void * getData1() const
void setData2(const void *d)
void Profile(llvm::FoldingSetNodeID &ID) const
BlockEntrance(const CFGBlock *B, const LocationContext *L, const ProgramPointTag *tag=nullptr)
CallExitEnd(const StackFrameContext *CalleeCtx, const LocationContext *CallerCtx)
const void * getData2() const
ProgramPoint(const void *P, Kind k, const LocationContext *l, const ProgramPointTag *tag=nullptr)
static clang::ProgramPoint getEmptyKey()
CallExitBegin(const StackFrameContext *L)
static ProgramPoint getProgramPoint(const Stmt *S, ProgramPoint::Kind K, const LocationContext *LC, const ProgramPointTag *tag)
const T * getStmtAs() const
PostStmt(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
Represents a program point after a store evaluation.
PostInitializer(const CXXCtorInitializer *I, const void *Loc, const LocationContext *L)
Construct a PostInitializer point that represents a location after CXXCtorInitializer expression eval...
PostLoad(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
SimpleProgramPointTag(StringRef MsgProvider, StringRef Msg)
PostStmt(const Stmt *S, Kind k, const LocationContext *L, const ProgramPointTag *tag=nullptr)
static bool isEqual(const clang::ProgramPoint &L, const clang::ProgramPoint &R)
StringRef getTagDescription() const override
const void * getLocationValue() const
Returns the information about the location used in the store, how it was uttered in the code...
const CFGBlock * getSrc() const
bool operator==(const ProgramPoint &RHS) const
ID
Defines the set of possible language-specific address spaces.
const CFGBlock * getDst() const
StmtPoint(const Stmt *S, const void *p2, Kind k, const LocationContext *L, const ProgramPointTag *tag)
EpsilonPoint(const LocationContext *L, const void *Data1, const void *Data2=nullptr, const ProgramPointTag *tag=nullptr)
const Stmt * getStmt() const
virtual StringRef getTagDescription() const =0
T castAs() const
Convert to the specified ProgramPoint type, asserting that this ProgramPoint is of the desired type...
PreStore(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
ProgramPoint(const void *P1, const void *P2, Kind k, const LocationContext *l, const ProgramPointTag *tag=nullptr)
PreStmtPurgeDeadSymbols(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
CFGTerminator getTerminator()
PostImplicitCall(const Decl *D, SourceLocation Loc, const LocationContext *L, const ProgramPointTag *Tag=nullptr)
PostStmt(const Stmt *S, const void *data, Kind k, const LocationContext *L, const ProgramPointTag *tag=nullptr)
PostStore(const Stmt *S, const LocationContext *L, const void *Loc, const ProgramPointTag *tag=nullptr)
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
unsigned getHashValue() const
Optional< CFGElement > getFirstElement() const
CallEnter(const Stmt *stmt, const StackFrameContext *calleeCtx, const LocationContext *callerCtx)
const void * getLocationValue() const
Returns the location of the field.
ProgramPoint withTag(const ProgramPointTag *tag) const
const StackFrameContext * getCalleeContext() const
BlockExit(const CFGBlock *B, const LocationContext *L)
const LocationContext * getLocationContext() const
const Stmt * getSubStmt() const
bool isPurgeKind()
Is this a program point corresponding to purge/removal of dead symbols and bindings.
SourceLocation getLocation() const
Optional< T > getAs() const
Convert to the specified ProgramPoint type, returning None if this ProgramPoint is not of the desired...
PostCondition(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
const Stmt * getTerminator() const
const void * getTagKind()
Used to implement 'isKind' in subclasses.
ImplicitCallPoint(const Decl *D, SourceLocation Loc, Kind K, const LocationContext *L, const ProgramPointTag *Tag)
const Decl * getDecl() const
PostStmtPurgeDeadSymbols(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
Represents a C++ base or member initializer.
LocationCheck(const Stmt *S, const LocationContext *L, ProgramPoint::Kind K, const ProgramPointTag *tag)
const CXXCtorInitializer * getInitializer() const
PreImplicitCall(const Decl *D, SourceLocation Loc, const LocationContext *L, const ProgramPointTag *Tag=nullptr)
const ProgramPointTag * getTag() const
static SourceLocation getFromPtrEncoding(const void *Encoding)
Turn a pointer encoding of a SourceLocation object back into a real SourceLocation.
virtual ~ProgramPointTag()
const CFGBlock * getBlock() const
const void * getData() const
const Stmt * getCallExpr() const