clang
8.0.0
|
AnalysisDeclContext contains the context data for the function or method under analysis. More...
#include "clang/Analysis/AnalysisDeclContext.h"
Public Types | |
using | referenced_decls_iterator = const VarDecl *const * |
Public Member Functions | |
AnalysisDeclContext (AnalysisDeclContextManager *Mgr, const Decl *D) | |
AnalysisDeclContext (AnalysisDeclContextManager *Mgr, const Decl *D, const CFG::BuildOptions &BuildOptions) | |
~AnalysisDeclContext () | |
ASTContext & | getASTContext () const |
const Decl * | getDecl () const |
AnalysisDeclContextManager * | getManager () const |
Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext. More... | |
CFG::BuildOptions & | getCFGBuildOptions () |
Return the build options used to construct the CFG. More... | |
const CFG::BuildOptions & | getCFGBuildOptions () const |
bool | getAddEHEdges () const |
getAddEHEdges - Return true iff we are adding exceptional edges from callExprs. More... | |
bool | getUseUnoptimizedCFG () const |
bool | getAddImplicitDtors () const |
bool | getAddInitializers () const |
void | registerForcedBlockExpression (const Stmt *stmt) |
const CFGBlock * | getBlockForRegisteredExpression (const Stmt *stmt) |
Stmt * | getBody () const |
Get the body of the Declaration. More... | |
Stmt * | getBody (bool &IsAutosynthesized) const |
Get the body of the Declaration. More... | |
bool | isBodyAutosynthesized () const |
Checks if the body of the Decl is generated by the BodyFarm. More... | |
bool | isBodyAutosynthesizedFromModelFile () const |
Checks if the body of the Decl is generated by the BodyFarm from a model file. More... | |
CFG * | getCFG () |
CFGStmtMap * | getCFGStmtMap () |
CFGReverseBlockReachabilityAnalysis * | getCFGReachablityAnalysis () |
CFG * | getUnoptimizedCFG () |
Return a version of the CFG without any edges pruned. More... | |
void | dumpCFG (bool ShowColors) |
bool | isCFGBuilt () const |
Returns true if we have built a CFG for this analysis context. More... | |
ParentMap & | getParentMap () |
llvm::iterator_range< referenced_decls_iterator > | getReferencedBlockVars (const BlockDecl *BD) |
const ImplicitParamDecl * | getSelfDecl () const |
Return the ImplicitParamDecl* associated with 'self' if this AnalysisDeclContext wraps an ObjCMethodDecl. More... | |
const StackFrameContext * | getStackFrame (LocationContext const *Parent, const Stmt *S, const CFGBlock *Blk, unsigned Idx) |
const BlockInvocationContext * | getBlockInvocationContext (const LocationContext *parent, const BlockDecl *BD, const void *ContextData) |
template<typename T > | |
T * | getAnalysis () |
Return the specified analysis object, lazily running the analysis if necessary. More... | |
Static Public Member Functions | |
static bool | isInStdNamespace (const Decl *D) |
Returns true if the root namespace of the given declaration is the 'std' C++ namespace. More... | |
AnalysisDeclContext contains the context data for the function or method under analysis.
Definition at line 70 of file AnalysisDeclContext.h.
using clang::AnalysisDeclContext::referenced_decls_iterator = const VarDecl * const * |
Definition at line 177 of file AnalysisDeclContext.h.
AnalysisDeclContext::AnalysisDeclContext | ( | AnalysisDeclContextManager * | Mgr, |
const Decl * | D | ||
) |
Definition at line 62 of file AnalysisDeclContext.cpp.
References clang::CFG::BuildOptions::forcedBlkExprs.
AnalysisDeclContext::AnalysisDeclContext | ( | AnalysisDeclContextManager * | Mgr, |
const Decl * | D, | ||
const CFG::BuildOptions & | BuildOptions | ||
) |
Definition at line 55 of file AnalysisDeclContext.cpp.
References clang::CFG::BuildOptions::forcedBlkExprs.
AnalysisDeclContext::~AnalysisDeclContext | ( | ) |
Definition at line 620 of file AnalysisDeclContext.cpp.
References clang::LocationContext::~LocationContext().
void AnalysisDeclContext::dumpCFG | ( | bool | ShowColors | ) |
Definition at line 274 of file AnalysisDeclContext.cpp.
|
inline |
getAddEHEdges - Return true iff we are adding exceptional edges from callExprs.
If this is false, then try/catch statements and blocks reachable from them can appear to be dead in the CFG, analysis passes must cope with that.
Definition at line 126 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::AddEHEdges.
Referenced by CheckFallThrough().
|
inline |
Definition at line 130 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::AddImplicitDtors.
|
inline |
Definition at line 131 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::AddInitializers, and clang::ast_matchers::stmt.
|
inline |
Return the specified analysis object, lazily running the analysis if necessary.
Return NULL if the analysis could not run.
Definition at line 199 of file AnalysisDeclContext.h.
References clang::serialized_diags::create().
Referenced by clang::ento::AnalysisManager::getAnalysis(), clang::threadSafety::CFGWalker::init(), mayInlineDecl(), clang::consumed::ConsumedAnalyzer::run(), and clang::runUninitializedVariablesAnalysis().
|
inline |
Definition at line 104 of file AnalysisDeclContext.h.
References clang::Decl::getASTContext().
Referenced by DiagnoseSwitchLabelsFallthrough(), clang::reachable_code::FindUnreachableCode(), clang::ento::SValBuilder::getRegionValueSymbolVal(), clang::ento::getWidenedLoopState(), isPointerToConst(), mayInlineDecl(), printObjectsUnderConstructionForContext(), and clang::consumed::ConsumedAnalyzer::run().
Definition at line 189 of file AnalysisDeclContext.cpp.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
const BlockInvocationContext * AnalysisDeclContext::getBlockInvocationContext | ( | const LocationContext * | parent, |
const BlockDecl * | BD, | ||
const void * | ContextData | ||
) |
Definition at line 317 of file AnalysisDeclContext.cpp.
References clang::LocationContextManager::getBlockInvocationContext().
Referenced by REGISTER_MAP_WITH_PROGRAMSTATE().
Stmt * AnalysisDeclContext::getBody | ( | ) | const |
Get the body of the Declaration.
Definition at line 125 of file AnalysisDeclContext.cpp.
Referenced by DiagnoseSwitchLabelsFallthrough(), getLocationForCaller(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), LookThroughTransitiveAssignmentsAndCommaOperators(), and clang::ento::ExprEngine::removeDeadOnEndOfFunction().
Get the body of the Declaration.
[out] | IsAutosynthesized | Specifies if the body is auto-generated by the BodyFarm. |
Definition at line 92 of file AnalysisDeclContext.cpp.
CFG * AnalysisDeclContext::getCFG | ( | ) |
Definition at line 212 of file AnalysisDeclContext.cpp.
References addParentsForSyntheticStmts(), clang::CFG::buildCFG(), clang::AnalysisDeclContextManager::getCFGBuildOptions(), clang::CFG::BuildOptions::Observer, and clang::CFG::BuildOptions::PruneTriviallyFalseEdges.
Referenced by clang::DominatorTree::buildDominatorTree(), CheckFallThrough(), checkRecursiveFunction(), checkThrowInNonThrowingFunc(), clang::LiveVariables::computeLiveness(), clang::PostOrderCFGView::create(), DiagnoseSwitchLabelsFallthrough(), clang::reachable_code::FindUnreachableCode(), clang::ento::AnalysisManager::getCFG(), clang::threadSafety::CFGWalker::init(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), mayInlineDecl(), clang::ento::ExprEngine::processCallExit(), and clang::consumed::ConsumedAnalyzer::run().
|
inline |
Return the build options used to construct the CFG.
Definition at line 114 of file AnalysisDeclContext.h.
Referenced by clang::ento::ExprEngine::bindReturnValue(), clang::reachable_code::FindUnreachableCode(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), and clang::ento::ExprEngine::VisitCXXConstructExpr().
|
inline |
Definition at line 118 of file AnalysisDeclContext.h.
CFGReverseBlockReachabilityAnalysis * AnalysisDeclContext::getCFGReachablityAnalysis | ( | ) |
Definition at line 262 of file AnalysisDeclContext.cpp.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
CFGStmtMap * AnalysisDeclContext::getCFGStmtMap | ( | ) |
Definition at line 250 of file AnalysisDeclContext.cpp.
References clang::CFGStmtMap::Build().
Referenced by clang::ento::CallEvent::getCalleeStackFrame().
|
inline |
Definition at line 105 of file AnalysisDeclContext.h.
Referenced by CheckUnreachable(), DiagnoseSwitchLabelsFallthrough(), findVar(), clang::ento::CallEvent::getCalleeAnalysisDeclContext(), getLocationForCaller(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), clang::threadSafety::CFGWalker::init(), isPointerToConst(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), LookThroughTransitiveAssignmentsAndCommaOperators(), mayInlineDecl(), and clang::consumed::ConsumedAnalyzer::run().
|
inline |
Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext.
Definition at line 109 of file AnalysisDeclContext.h.
Referenced by clang::ento::CallEvent::getCalleeAnalysisDeclContext(), and clang::ento::CallEvent::getCalleeStackFrame().
ParentMap & AnalysisDeclContext::getParentMap | ( | ) |
Definition at line 278 of file AnalysisDeclContext.cpp.
References addParentsForSyntheticStmts(), clang::ParentMap::addStmt(), and clang::C.
Referenced by clang::ento::AnalysisManager::getParentMap(), and clang::sema::AnalysisBasedWarnings::IssueWarnings().
llvm::iterator_range< AnalysisDeclContext::referenced_decls_iterator > AnalysisDeclContext::getReferencedBlockVars | ( | const BlockDecl * | BD | ) |
Definition at line 598 of file AnalysisDeclContext.cpp.
References LazyInitializeReferencedDecls(), and clang::ManagedAnalysis::~ManagedAnalysis().
Referenced by clang::ento::MemRegion::getAsOffset().
const ImplicitParamDecl * AnalysisDeclContext::getSelfDecl | ( | ) | const |
Return the ImplicitParamDecl* associated with 'self' if this AnalysisDeclContext wraps an ObjCMethodDecl.
Returns NULL otherwise.
Definition at line 147 of file AnalysisDeclContext.cpp.
References clang::CXXRecordDecl::captures(), clang::DeclContext::getParent(), clang::CXXRecordDecl::isLambda(), and isSelfDecl().
Referenced by clang::ObjCMethodCall::getInitialStackFrameContents(), clang::LocationContext::getSelfDecl(), and isSelfVar().
const StackFrameContext * AnalysisDeclContext::getStackFrame | ( | LocationContext const * | Parent, |
const Stmt * | S, | ||
const CFGBlock * | Blk, | ||
unsigned | Idx | ||
) |
Definition at line 311 of file AnalysisDeclContext.cpp.
Referenced by REGISTER_MAP_WITH_PROGRAMSTATE().
CFG * AnalysisDeclContext::getUnoptimizedCFG | ( | ) |
Return a version of the CFG without any edges pruned.
Definition at line 231 of file AnalysisDeclContext.cpp.
References addParentsForSyntheticStmts(), clang::CFG::buildCFG(), clang::AnalysisDeclContextManager::getCFGBuildOptions(), clang::CFG::BuildOptions::Observer, and clang::CFG::BuildOptions::PruneTriviallyFalseEdges.
|
inline |
Definition at line 127 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::PruneTriviallyFalseEdges.
bool AnalysisDeclContext::isBodyAutosynthesized | ( | ) | const |
Checks if the body of the Decl is generated by the BodyFarm.
Note, the lookup is not free. We are going to call getBody behind the scenes.
Definition at line 130 of file AnalysisDeclContext.cpp.
Referenced by CompactMacroExpandedPieces(), findTopAutosynthesizedParentContext(), clang::ento::PathDiagnosticLocation::getStmt(), clang::ento::retaincountchecker::isSynthesizedAccessor(), mayInlineDecl(), and clang::ento::PathDiagnosticCallPiece::setCallee().
bool AnalysisDeclContext::isBodyAutosynthesizedFromModelFile | ( | ) | const |
Checks if the body of the Decl is generated by the BodyFarm from a model file.
Note, the lookup is not free. We are going to call getBody behind the scenes.
Definition at line 136 of file AnalysisDeclContext.cpp.
References clang::Stmt::getBeginLoc(), and clang::SourceLocation::isValid().
Referenced by CompactMacroExpandedPieces().
|
inline |
Returns true if we have built a CFG for this analysis context.
Note that this doesn't correspond to whether or not a valid CFG exists, it corresponds to whether we attempted to build one.
Definition at line 173 of file AnalysisDeclContext.h.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
Returns true if the root namespace of the given declaration is the 'std' C++ namespace.
Definition at line 324 of file AnalysisDeclContext.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), clang::DeclContext::isStdNamespace(), and Parent.
Referenced by mayInlineDecl().
void AnalysisDeclContext::registerForcedBlockExpression | ( | const Stmt * | stmt | ) |
Definition at line 179 of file AnalysisDeclContext.cpp.
References clang::ast_matchers::stmt.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().