clang: lib/StaticAnalyzer/Core/ExprEngine.cpp File Reference (original) (raw)

Go to the source code of this file.

Namespaces
namespace llvm
Diagnostic wrappers for TextAPI types for error reporting.
Functions
STATISTIC (NumRemoveDeadBindings, "The # of times RemoveDeadBindings is called")
STATISTIC (NumMaxBlockCountReached, "The # of aborted paths due to reaching the maximum block count in " "a top level function")
STATISTIC (NumMaxBlockCountReachedInInlined, "The # of aborted paths due to reaching the maximum block count in " "an inlined function")
STATISTIC (NumTimesRetriedWithoutInlining, "The # of times we re-evaluated a call without inlining")
REGISTER_TRAIT_WITH_PROGRAMSTATE (PendingArrayDestruction, PendingArrayDestructionMap) static const char *TagProviderName
static void printObjectsUnderConstructionJson (raw_ostream &Out, ProgramStateRef State, const char *NL, const LocationContext *LCtx, unsigned int Space=0, bool IsDot=false)
static void printIndicesOfElementsToConstructJson (raw_ostream &Out, ProgramStateRef State, const char *NL, const LocationContext *LCtx, unsigned int Space=0, bool IsDot=false)
static void printPendingInitLoopJson (raw_ostream &Out, ProgramStateRef State, const char *NL, const LocationContext *LCtx, unsigned int Space=0, bool IsDot=false)
static void printPendingArrayDestructionsJson (raw_ostream &Out, ProgramStateRef State, const char *NL, const LocationContext *LCtx, unsigned int Space=0, bool IsDot=false)
template<typename Trait , typename Printer , typename... Args>
static void printStateTraitWithLocationContextJson (raw_ostream &Out, ProgramStateRef State, const LocationContext *LCtx, const char *NL, unsigned int Space, bool IsDot, const char *jsonPropertyName, Printer printer, Args &&...args)
A helper function to generalize program state trait printing.
static bool shouldRemoveDeadBindings (AnalysisManager &AMgr, const Stmt *S, const ExplodedNode *Pred, const LocationContext *LC)
static SVal RecoverCastedSymbol (ProgramStateRef state, const Stmt *Condition, const LocationContext *LCtx, ASTContext &Ctx)
RecoverCastedSymbol - A helper function for ProcessBranch that is used to try to recover some path-sensitivity for casts of symbolic integers that promote their values (which are currently not tracked well).
static const Stmt * getRightmostLeaf (const Stmt *Condition)
static const Stmt * ResolveCondition (const Stmt *Condition, const CFGBlock *B)
static std::optional< std::pair< ProgramStateRef, ProgramStateRef > > assumeCondition (const Stmt *Condition, ExplodedNode *N)
Split the state on whether there are any more iterations left for this loop.
REGISTER_TRAIT_WITH_PROGRAMSTATE (InitializedGlobalsSet, llvm::ImmutableSet< const VarDecl * >) void ExprEngine
The GDM component containing the set of global variables which have been previously initialized with explicit initializers.
REGISTER_TRAIT_WITH_PROGRAMSTATE (LastEagerlyAssumeExprIfSuccessful, const Expr *) void ExprEngine
If the last EagerlyAssume attempt was successful (i.e.

DEBUG_TYPE

#define DEBUG_TYPE "ExprEngine"

ObjCForLctxPair

ObjectsUnderConstructionMap

assumeCondition()

Split the state on whether there are any more iterations left for this loop.

Returns a (HasMoreIteration, HasNoMoreIteration) pair, or std::nullopt when the acquisition of the loop condition value failed.

Definition at line 2720 of file ExprEngine.cpp.

References clang::Condition, clang::ento::ExplodedNode::getLocationContext(), clang::ento::ExplodedNode::getState(), clang::ento::ExprEngine::hasMoreIteration(), clang::ento::SVal::isUnknown(), RecoverCastedSymbol(), clang::ento::ExprEngine::removeIterationState(), V, and X.

Referenced by clang::ento::ExprEngine::processBranch().

getRightmostLeaf()

static const Stmt * getRightmostLeaf ( const Stmt * Condition) static

printIndicesOfElementsToConstructJson()

Definition at line 731 of file ExprEngine.cpp.

References E, clang::LocationContext::getAnalysisDeclContext(), clang::QualType::getAsString(), clang::AnalysisDeclContext::getASTContext(), clang::Stmt::getID(), clang::ASTContext::getPrintingPolicy(), clang::ASTContext::getSourceManager(), clang::Stmt::getSourceRange(), clang::Stmt::getStmtClassName(), clang::Expr::getType(), clang::SourceRange::printToString(), and clang::QualType::split().

Referenced by clang::ento::ExprEngine::printJson().

printObjectsUnderConstructionJson()

printPendingArrayDestructionsJson()

printPendingInitLoopJson()

Definition at line 793 of file ExprEngine.cpp.

References E, clang::LocationContext::getAnalysisDeclContext(), clang::QualType::getAsString(), clang::AnalysisDeclContext::getASTContext(), clang::Stmt::getID(), clang::ASTContext::getPrintingPolicy(), clang::ASTContext::getSourceManager(), clang::Stmt::getSourceRange(), clang::Stmt::getStmtClassName(), clang::Expr::getType(), clang::SourceRange::printToString(), and clang::QualType::split().

Referenced by clang::ento::ExprEngine::printJson().

printStateTraitWithLocationContextJson()

template<typename Trait , typename Printer , typename... Args>

static void printStateTraitWithLocationContextJson ( raw_ostream & Out, ProgramStateRef State, const LocationContext * LCtx, const char * NL, unsigned int Space, bool IsDot, const char * jsonPropertyName, Printer printer, Args &&... args ) static

A helper function to generalize program state trait printing.

The function invokes Printer as 'Printer(Out, State, NL, LC, Space, IsDot, std::forward(args)...)'.
One possible type for Printer is 'void()(raw_ostream &, ProgramStateRef, const char *, const LocationContext *, unsigned int, bool, ...)'

Parameters

Trait The state trait to be printed.
Printer A void function that prints Trait.
Args An additional parameter pack that is passed to Print upon invocation.

Definition at line 910 of file ExprEngine.cpp.

References bool, int, and clang::LocationContext::printJson().

RecoverCastedSymbol()

REGISTER_TRAIT_WITH_PROGRAMSTATE() [1/3]

REGISTER_TRAIT_WITH_PROGRAMSTATE ( InitializedGlobalsSet ,
llvm::ImmutableSet< const VarDecl * >
)

REGISTER_TRAIT_WITH_PROGRAMSTATE() [2/3]

REGISTER_TRAIT_WITH_PROGRAMSTATE ( LastEagerlyAssumeExprIfSuccessful ,
const Expr *
)

If the last EagerlyAssume attempt was successful (i.e.

the true and false cases were both feasible), this state trait stores the expression where it happened; otherwise this holds nullptr.

Definition at line 3765 of file ExprEngine.cpp.

References clang::ento::StmtNodeBuilder::generateNode(), clang::ento::ExprEngine::getEagerlyAssumeBifurcationTags(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::getLocationContext(), clang::ento::ExplodedNode::getState(), clang::StmtPoint::getStmt(), clang::Expr::getType(), clang::ento::SValBuilder::makeIntVal(), P, and V.

REGISTER_TRAIT_WITH_PROGRAMSTATE() [3/3]

ResolveCondition()

static const Stmt * ResolveCondition ( const Stmt * Condition, const CFGBlock * B ) static

shouldRemoveDeadBindings()

STATISTIC() [1/4]

STATISTIC ( NumMaxBlockCountReached ,
"The # of aborted paths due to reaching the maximum block count in " "a top level function"
)

STATISTIC() [2/4]

STATISTIC ( NumMaxBlockCountReachedInInlined ,
"The # of aborted paths due to reaching the maximum block count in " "an inlined function"
)

STATISTIC() [3/4]

STATISTIC ( NumRemoveDeadBindings ,
"The # of times RemoveDeadBindings is called"
)

STATISTIC() [4/4]

STATISTIC ( NumTimesRetriedWithoutInlining ,
"The # of times we re-evaluated a call without inlining"
)

PendingArrayDestructionMap