15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERCONTEXT_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERCONTEXT_H
36 #define REGISTER_MAP_WITH_PROGRAMSTATE(Name, Key, Value) \
37 REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, \
38 CLANG_ENTO_PROGRAMSTATE_MAP(Key, Value))
52 #define REGISTER_SET_WITH_PROGRAMSTATE(Name, Elem) \
53 REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableSet<Elem>)
66 #define REGISTER_LIST_WITH_PROGRAMSTATE(Name, Elem) \
67 REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableList<Elem>)
99 "We should not call the checkers on an empty state.");
190 return reinterpret_cast<const MemRegion*
>(PSL->getLocationValue());
223 return addTransitionImpl(State,
false, Pred, Tag);
272 StringRef Name = StringRef());
290 if (!State || (State == Pred->
getState() && !Tag && !MarkAsSink))
StringRef getCalleeName(const FunctionDecl *FunDecl) const
Get the name of the called function (path-sensitive).
SymbolManager & getSymbolManager()
MemRegion - The root abstract class for all memory regions.
IdentifierInfo * getIdentifier() const
virtual bool inTopFrame() const
Return true if the current LocationContext has no caller context.
ProgramPoint getLocation() const
getLocation - Returns the edge associated with the given node.
ExplodedNode * addTransition(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generates a new transition in the program state graph (ExplodedGraph). Uses the default CheckerContex...
AnalysisManager & getAnalysisManager()
CheckerContext(NodeBuilder &builder, ExprEngine &eng, ExplodedNode *pred, const ProgramPoint &loc, bool wasInlined=false)
ExplodedNode * getPredecessor()
Returns the previous node in the exploded graph, which includes the state of the program before the c...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const FunctionDecl * getCalleeDecl(const CallExpr *CE) const
Get the declaration of the called function (path-sensitive).
Represents a program point after a store evaluation.
AnalysisDeclContext * getAnalysisDeclContext() const
unsigned blockCount() const
Returns the number of times the current block has been visited along the analyzed path...
ASTContext & getContext() const
getContext - Return the ASTContext associated with this analysis.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
BugReporter & getBugReporter()
const IdentifierInfo * getCalleeIdentifier(const CallExpr *CE) const
Get the identifier of the called function (path-sensitive).
const LangOptions & getLangOpts() const
ProgramStateManager & getStateManager()
const LocationContext * getLocationContext() const
ExplodedNode * generateSink(ProgramStateRef State=nullptr, ExplodedNode *Pred=nullptr, const ProgramPointTag *Tag=nullptr)
Generate a sink node. Generating a sink stops exploration of the given path.
unsigned blockCount() const
Returns the number of times the current basic block has been visited on the exploded graph path...
bool inTopFrame() const
Return true if the current LocationContext has no caller context.
ExplodedNode * generateSink(const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred)
Generates a sink in the ExplodedGraph.
const ProgramStateRef & getState() const
const ProgramStateRef & getState() const
static bool isCLibraryFunction(const FunctionDecl *FD, StringRef Name=StringRef())
Returns true if the callee is an externally-visible function in the top-level namespace, such as malloc.
This is the simplest builder which generates nodes in the ExplodedGraph.
ExplodedNode * addTransition(ProgramStateRef State, ExplodedNode *Pred, const ProgramPointTag *Tag=nullptr)
Generates a new transition with the given predecessor. Allows checkers to generate a chain of nodes...
SymbolManager & getSymbolManager()
unsigned getBlockID() const
ConstraintManager & getConstraintManager()
void emitReport(std::unique_ptr< BugReport > R)
Emit the diagnostics report.
StoreManager & getStoreManager()
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
AnalysisManager & getAnalysisManager() override
void emitReport(std::unique_ptr< BugReport > R)
Add the given report to the set of reports tracked by BugReporter.
ProgramPoint withTag(const ProgramPointTag *tag) const
BugReporter & getBugReporter()
const StackFrameContext * getStackFrame() const
ASTContext & getASTContext()
SValBuilder & getSValBuilder()
StoreManager & getStoreManager()
const NodeBuilderContext & getContext()
StringRef getMacroNameOrSpelling(SourceLocation &Loc)
Depending on wither the location corresponds to a macro, return either the macro name or the token sp...
StringRef getCalleeName(const CallExpr *CE) const
Get the name of the called function (path-sensitive).
Optional< T > getAs() const
Convert to the specified ProgramPoint type, returning None if this ProgramPoint is not of the desired...
ProgramStateManager & getStateManager() override
const CFGBlock * getBlock() const
Return the CFGBlock associated with this builder.
const LangOptions & getLangOpts() const
const StackFrameContext * getStackFrame() const
ExplodedNode * generateNode(const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred)
Generates a node in the ExplodedGraph.
SourceManager & getSourceManager()
AnalysisDeclContext * getCurrentAnalysisDeclContext() const
unsigned getBlockID() const
Get the blockID.
SourceManager & getSourceManager()
bool isObjCGCEnabled() const
SValBuilder & getSValBuilder()
static const MemRegion * getLocationRegionIfPostStore(const ExplodedNode *N)
If the given node corresponds to a PostStore program point, retrieve the location region as it was ut...
ConstraintManager & getConstraintManager()
bool isDifferent()
Check if the checker changed the state of the execution; ex: added a new transition or a bug report...
This class handles loading and caching of source files into memory.
const LocationContext * getLocationContext() const
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.