clang
7.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 () |
PseudoConstantAnalysis * | getPseudoConstantAnalysis () |
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 71 of file AnalysisDeclContext.h.
using clang::AnalysisDeclContext::referenced_decls_iterator = const VarDecl * const * |
Definition at line 180 of file AnalysisDeclContext.h.
AnalysisDeclContext::AnalysisDeclContext | ( | AnalysisDeclContextManager * | Mgr, |
const Decl * | D | ||
) |
Definition at line 63 of file AnalysisDeclContext.cpp.
References clang::CFG::BuildOptions::forcedBlkExprs.
AnalysisDeclContext::AnalysisDeclContext | ( | AnalysisDeclContextManager * | Mgr, |
const Decl * | D, | ||
const CFG::BuildOptions & | BuildOptions | ||
) |
Definition at line 56 of file AnalysisDeclContext.cpp.
References clang::CFG::BuildOptions::forcedBlkExprs.
AnalysisDeclContext::~AnalysisDeclContext | ( | ) |
Definition at line 627 of file AnalysisDeclContext.cpp.
References clang::LocationContext::~LocationContext().
void AnalysisDeclContext::dumpCFG | ( | bool | ShowColors | ) |
Definition at line 275 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 128 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::AddEHEdges.
Referenced by CheckFallThrough().
|
inline |
Definition at line 132 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::AddImplicitDtors.
|
inline |
Definition at line 133 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 202 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 106 of file AnalysisDeclContext.h.
References clang::Decl::getASTContext().
Referenced by clang::ento::SValBuilder::conjureSymbolVal(), DiagnoseSwitchLabelsFallthrough(), clang::ento::getWidenedLoopState(), mayInlineDecl(), clang::consumed::ConsumedStateMap::operator!=(), printObjectsUnderConstructionForContext(), and clang::consumed::ConsumedAnalyzer::run().
Definition at line 190 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 324 of file AnalysisDeclContext.cpp.
References clang::LocationContextManager::getBlockInvocationContext().
Referenced by REGISTER_TRAIT_WITH_PROGRAMSTATE().
Stmt * AnalysisDeclContext::getBody | ( | ) | const |
Get the body of the Declaration.
Definition at line 126 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 93 of file AnalysisDeclContext.cpp.
CFG * AnalysisDeclContext::getCFG | ( | ) |
Definition at line 213 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(), and clang::consumed::ConsumedAnalyzer::run().
|
inline |
Return the build options used to construct the CFG.
Definition at line 116 of file AnalysisDeclContext.h.
Referenced by clang::reachable_code::FindUnreachableCode(), and clang::sema::AnalysisBasedWarnings::IssueWarnings().
|
inline |
Definition at line 120 of file AnalysisDeclContext.h.
CFGReverseBlockReachabilityAnalysis * AnalysisDeclContext::getCFGReachablityAnalysis | ( | ) |
Definition at line 263 of file AnalysisDeclContext.cpp.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
CFGStmtMap * AnalysisDeclContext::getCFGStmtMap | ( | ) |
Definition at line 251 of file AnalysisDeclContext.cpp.
References clang::CFGStmtMap::Build().
|
inline |
Definition at line 107 of file AnalysisDeclContext.h.
Referenced by CheckUnreachable(), DiagnoseSwitchLabelsFallthrough(), getLocationForCaller(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), clang::threadSafety::CFGWalker::init(), isDebuggingContext(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), LookThroughTransitiveAssignmentsAndCommaOperators(), mayInlineDecl(), clang::consumed::ConsumedAnalyzer::run(), and seenBeforeRec().
|
inline |
Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext.
Definition at line 111 of file AnalysisDeclContext.h.
Referenced by clang::ento::CallEvent::getCalleeAnalysisDeclContext().
ParentMap & AnalysisDeclContext::getParentMap | ( | ) |
Definition at line 279 of file AnalysisDeclContext.cpp.
References clang::C.
Referenced by clang::ento::AnalysisManager::getParentMap(), and clang::sema::AnalysisBasedWarnings::IssueWarnings().
PseudoConstantAnalysis * AnalysisDeclContext::getPseudoConstantAnalysis | ( | ) |
Definition at line 295 of file AnalysisDeclContext.cpp.
llvm::iterator_range< AnalysisDeclContext::referenced_decls_iterator > AnalysisDeclContext::getReferencedBlockVars | ( | const BlockDecl * | BD | ) |
Definition at line 605 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 148 of file AnalysisDeclContext.cpp.
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 318 of file AnalysisDeclContext.cpp.
Referenced by REGISTER_TRAIT_WITH_PROGRAMSTATE().
CFG * AnalysisDeclContext::getUnoptimizedCFG | ( | ) |
Return a version of the CFG without any edges pruned.
Definition at line 232 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 129 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 131 of file AnalysisDeclContext.cpp.
Referenced by findTopAutosynthesizedParentContext(), clang::ento::PathDiagnosticLocation::getStmt(), 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 137 of file AnalysisDeclContext.cpp.
References clang::Stmt::getLocStart(), and clang::SourceLocation::isValid().
|
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 175 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 331 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 180 of file AnalysisDeclContext.cpp.
References clang::ast_matchers::stmt.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().