14#ifndef LLVM_CLANG_ANALYSIS_PROGRAMPOINT_H 
   15#define LLVM_CLANG_ANALYSIS_PROGRAMPOINT_H 
   19#include "llvm/ADT/DenseMap.h" 
   20#include "llvm/ADT/FoldingSet.h" 
   21#include "llvm/ADT/PointerIntPair.h" 
   22#include "llvm/ADT/StringRef.h" 
   23#include "llvm/Support/Casting.h" 
   24#include "llvm/Support/DataTypes.h" 
   51  const void *
const TagKind;
 
 
   96  llvm::PointerIntPair<const void *, 2, unsigned> Data2;
 
  100  llvm::PointerIntPair<const LocationContext *, 2, unsigned> L;
 
  102  llvm::PointerIntPair<const ProgramPointTag *, 2, unsigned> Tag;
 
  122      : Data1(P1), Data2(P2, (((
unsigned)k) >> 0) & 0x3),
 
 
  128  const void *
getData2()
 const { 
return Data2.getPointer(); }
 
  129  void setData2(
const void *d) { Data2.setPointer(d); }
 
  144    assert(T::isKind(*
this));
 
 
  153  template <
typename T> std::optional<T> 
getAs()
 const {
 
  154    if (!T::isKind(*
this))
 
 
  163    unsigned x = Tag.getInt();
 
 
  182    return L.getPointer();
 
 
  191    llvm::FoldingSetNodeID ID;
 
  193    return ID.ComputeHash();
 
 
  197    return Data1 == RHS.Data1 && Data2 == RHS.Data2 && L == RHS.L &&
 
  198           Tag == RHS.Tag && ElemRef == RHS.ElemRef;
 
 
  202    return Data1 != RHS.Data1 || Data2 != RHS.Data2 || L != RHS.L ||
 
  203           Tag != RHS.Tag || ElemRef != RHS.ElemRef;
 
 
  206  void Profile(llvm::FoldingSetNodeID& ID)
 const {
 
  207    ID.AddInteger((
unsigned) 
getKind());
 
  212    ID.AddPointer(ElemRef.getParent());
 
  213    ID.AddInteger(ElemRef.getIndexInBlock());
 
 
  216  void printJson(llvm::raw_ostream &Out, 
const char *NL = 
"\n") 
const;
 
  218  LLVM_DUMP_METHOD 
void dump() 
const;
 
 
  230    assert(CurrBlock && 
"BlockEntrance requires non-null block");
 
 
  243    return B->
empty() ? std::optional<CFGElement>() : B->
front();
 
 
 
  286  template <
typename T>
 
  294    unsigned k = Location.getKind();
 
 
  303          const Stmt *SubStmt = 
nullptr)
 
 
 
  335    unsigned k = Location.getKind();
 
 
  388    unsigned k = location.
getKind();
 
 
  512    assert(B1 && 
"BlockEdge: source block must be non-null");
 
  513    assert(B2 && 
"BlockEdge: destination block must be non-null");
 
 
 
  569      : 
ProgramPoint(Loc.getPtrEncoding(), D, K, L, Tag, ElemRef) {}
 
 
 
  655    const CFG *CalleeCFG = CalleeCtx->
getCFG();
 
 
 
  743               const void *Data2 = 
nullptr,
 
 
 
  762template <> 
struct DenseMapInfo<
clang::ProgramPoint> {
 
  766   reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getEmptyKey()) & ~0x7;
 
 
  773   reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getTombstoneKey()) & ~0x7;
 
 
 
This file defines AnalysisDeclContext, a class that manages the analysis context data for context sen...
AnalysisDeclContext contains the context data for the function, method or block under analysis.
const CFGBlock * getSrc() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
const CFGBlock * getDst() const
BlockEdge(const CFGBlock *B1, const CFGBlock *B2, const LocationContext *L)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
BlockEntrance(const CFGBlock *PrevBlock, const CFGBlock *CurrBlock, const LocationContext *L, const ProgramPointTag *Tag=nullptr)
std::optional< CFGElement > getFirstElement() const
const CFGBlock * getPreviousBlock() const
const CFGBlock * getBlock() const
const CFGBlock * getBlock() const
const Stmt * getTerminator() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
BlockExit(const CFGBlock *B, const LocationContext *L)
Represents a single basic block in a source-level CFG.
ElementRefImpl< true > ConstCFGElementRef
Stmt * getTerminatorStmt()
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.
Represents a C++ base or member initializer.
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
CallEnter(const Stmt *stmt, const StackFrameContext *calleeCtx, const LocationContext *callerCtx)
const Stmt * getCallExpr() const
const CFGBlock * getEntry() const
Returns the entry block in the CFG for the entered function.
const StackFrameContext * getCalleeContext() const
CallExitBegin(const StackFrameContext *L, const ReturnStmt *RS)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
const ReturnStmt * getReturnStmt() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
CallExitEnd(const StackFrameContext *CalleeCtx, const LocationContext *CallerCtx)
const StackFrameContext * getCalleeContext() const
Decl - This represents one declaration (or definition), e.g.
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
EpsilonPoint(const LocationContext *L, const void *Data1, const void *Data2=nullptr, const ProgramPointTag *tag=nullptr)
const void * getData() const
const CFGBlock * getBlock() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
const ReturnStmt * getStmt() const
FunctionExitPoint(const ReturnStmt *S, const LocationContext *LC, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
SourceLocation getLocation() const
ImplicitCallPoint(const Decl *D, SourceLocation Loc, Kind K, const LocationContext *L, const ProgramPointTag *Tag, CFGBlock::ConstCFGElementRef ElemRef)
ImplicitCallPoint()=default
const Decl * getDecl() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
LocationCheck(const Stmt *S, const LocationContext *L, ProgramPoint::Kind K, const ProgramPointTag *tag)
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
const StackFrameContext * getStackFrame() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
LoopExit(const Stmt *LoopStmt, const LocationContext *LC)
const Stmt * getLoopStmt() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostAllocatorCall(const Stmt *S, const LocationContext *L, const ProgramPointTag *Tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostCondition(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostImplicitCall(const Decl *D, SourceLocation Loc, const LocationContext *L, CFGBlock::ConstCFGElementRef ElemRef, const ProgramPointTag *Tag=nullptr)
PostInitializer(const CXXCtorInitializer *I, const void *Loc, const LocationContext *L)
Construct a PostInitializer point that represents a location after CXXCtorInitializer expression eval...
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
const void * getLocationValue() const
Returns the location of the field.
const CXXCtorInitializer * getInitializer() const
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostLValue(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostLoad(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostStmtPurgeDeadSymbols(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostStmt(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
PostStmt(const Stmt *S, const void *data, Kind k, const LocationContext *L, const ProgramPointTag *tag=nullptr)
PostStmt(const Stmt *S, Kind k, const LocationContext *L, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PostStore(const Stmt *S, const LocationContext *L, const void *Loc, const ProgramPointTag *tag=nullptr)
Construct the post store point.
const void * getLocationValue() const
Returns the information about the location used in the store, how it was uttered in the code.
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PreImplicitCall(const Decl *D, SourceLocation Loc, const LocationContext *L, CFGBlock::ConstCFGElementRef ElemRef, const ProgramPointTag *Tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PreLoad(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PreStmtPurgeDeadSymbols(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
const Stmt * getSubStmt() const
PreStmt(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag, const Stmt *SubStmt=nullptr)
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
PreStore(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag=nullptr)
ProgramPoints can be "tagged" as representing points specific to a given analysis entity.
const void * getTagKind() const
Used to implement 'isKind' in subclasses.
virtual StringRef getDebugTag() const =0
The description of this program point which will be dumped for debugging purposes.
ProgramPointTag(void *tagKind=nullptr)
virtual ~ProgramPointTag()
const ProgramPointTag * getTag() const
bool isPurgeKind()
Is this a program point corresponding to purge/removal of dead symbols and bindings.
T castAs() const
Convert to the specified ProgramPoint type, asserting that this ProgramPoint is of the desired type.
static ProgramPoint getProgramPoint(const Stmt *S, ProgramPoint::Kind K, const LocationContext *LC, const ProgramPointTag *tag)
static StringRef getProgramPointKindName(Kind K)
LLVM_DUMP_METHOD void dump() const
CFGBlock::ConstCFGElementRef getElementRef() const
std::optional< SourceLocation > getSourceLocation() const
void Profile(llvm::FoldingSetNodeID &ID) const
void printJson(llvm::raw_ostream &Out, const char *NL="\n") const
void setData2(const void *d)
bool operator!=(const ProgramPoint &RHS) const
bool operator==(const ProgramPoint &RHS) const
unsigned getHashValue() const
ProgramPoint(const void *P, Kind k, const LocationContext *l, const ProgramPointTag *tag=nullptr, CFGBlock::ConstCFGElementRef ElemRef={nullptr, 0})
ProgramPoint(const void *P1, const void *P2, Kind k, const LocationContext *l, const ProgramPointTag *tag=nullptr, CFGBlock::ConstCFGElementRef ElemRef={nullptr, 0})
ProgramPoint withTag(const ProgramPointTag *tag) const
Create a new ProgramPoint object that is the same as the original except for using the specified tag ...
@ PreStmtPurgeDeadSymbolsKind
@ PostStmtPurgeDeadSymbolsKind
const void * getData1() const
const void * getData2() const
const StackFrameContext * getStackFrame() const
std::optional< T > getAs() const
Convert to the specified ProgramPoint type, returning std::nullopt if this ProgramPoint is not of the...
const LocationContext * getLocationContext() const
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
StringRef getDebugTag() const override
The description of this program point which will be dumped for debugging purposes.
SimpleProgramPointTag(StringRef MsgProvider, StringRef Msg)
Encodes a location in the source.
static SourceLocation getFromPtrEncoding(const void *Encoding)
Turn a pointer encoding of a SourceLocation object back into a real SourceLocation.
It represents a stack frame of the call stack (based on CallEvent).
friend class ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
StmtPoint(const Stmt *S, const void *p2, Kind k, const LocationContext *L, const ProgramPointTag *tag)
const Stmt * getStmt() const
const T * getStmtAs() const
Stmt - This represents one statement.
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
static bool isEqual(const clang::ProgramPoint &L, const clang::ProgramPoint &R)
static clang::ProgramPoint getTombstoneKey()
static unsigned getHashValue(const clang::ProgramPoint &Loc)
static clang::ProgramPoint getEmptyKey()