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);
231 return addTransitionImpl(State ? State :
getState(),
true, Pred, Tag);
244 (Tag ? Tag : Location.
getTag()));
302 StringRef
Name = StringRef());
332 if (!State || (State == Pred->
getState() && !Tag && !MarkAsSink))
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
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.
ExplodedNode * generateErrorNode(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generate a transition to a node that will be used to report an error.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
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).
StringRef getDeclDescription(const Decl *D)
Returns the word that should be used to refer to the declaration in the report.
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...
const bool wasInlined
If we are post visiting a call, this flag will be set if the call was inlined.
One of these records is kept for each identifier that is lexed.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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).
AnalysisDeclContext contains the context data for the function or method under analysis.
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
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.
SymbolManager & getSymbolManager()
unsigned getBlockID() const
ExplodedNode * generateNonFatalErrorNode(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generate a transition to a node that will be used to report an error.
ConstraintManager & getConstraintManager()
void emitReport(std::unique_ptr< BugReport > R)
Emit the diagnostics report.
BugReporter is a utility class for generating PathDiagnostics for analysis.
StoreManager & getStoreManager()
Encodes a location in the source.
ExplodedNode * generateSink(ProgramStateRef State, ExplodedNode *Pred, const ProgramPointTag *Tag=nullptr)
Generate a sink node.
ProgramPoints can be "tagged" as representing points specific to a given analysis entity...
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
Create a new ProgramPoint object that is the same as the original except for using the specified tag ...
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
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()
const ProgramPointTag * getTag() const
AnalysisDeclContext * getCurrentAnalysisDeclContext() const
unsigned getBlockID() const
Get the blockID.
SourceManager & getSourceManager()
bool isObjCGCEnabled() const
SValBuilder & getSValBuilder()
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
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.