clang
6.0.0
|
AnalysisDeclContext contains the context data for the function or method under analysis. More...
#include "clang/Analysis/AnalysisDeclContext.h"
Public Types | |
typedef const VarDecl *const * | referenced_decls_iterator |
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 67 of file AnalysisDeclContext.h.
typedef const VarDecl* const* clang::AnalysisDeclContext::referenced_decls_iterator |
Definition at line 175 of file AnalysisDeclContext.h.
AnalysisDeclContext::AnalysisDeclContext | ( | AnalysisDeclContextManager * | Mgr, |
const Decl * | D | ||
) |
Definition at line 53 of file AnalysisDeclContext.cpp.
References clang::CFG::BuildOptions::forcedBlkExprs.
AnalysisDeclContext::AnalysisDeclContext | ( | AnalysisDeclContextManager * | Mgr, |
const Decl * | D, | ||
const CFG::BuildOptions & | BuildOptions | ||
) |
Definition at line 38 of file AnalysisDeclContext.cpp.
References clang::CFG::BuildOptions::forcedBlkExprs.
AnalysisDeclContext::~AnalysisDeclContext | ( | ) |
Definition at line 592 of file AnalysisDeclContext.cpp.
void AnalysisDeclContext::dumpCFG | ( | bool | ShowColors | ) |
Definition at line 268 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 123 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::AddEHEdges.
Referenced by CheckFallThrough().
|
inline |
Definition at line 127 of file AnalysisDeclContext.h.
References clang::CFG::BuildOptions::AddImplicitDtors.
|
inline |
Definition at line 128 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 197 of file AnalysisDeclContext.h.
References clang::serialized_diags::create(), and clang::T.
Referenced by clang::ento::AnalysisManager::getAnalysis(), clang::threadSafety::CFGWalker::init(), mayInlineDecl(), clang::consumed::ConsumedAnalyzer::run(), and clang::runUninitializedVariablesAnalysis().
|
inline |
Definition at line 101 of file AnalysisDeclContext.h.
References clang::Decl::getASTContext().
Referenced by clang::ento::SValBuilder::conjureSymbolVal(), DiagnoseSwitchLabelsFallthrough(), mayInlineDecl(), clang::consumed::ConsumedStateMap::operator!=(), and clang::consumed::ConsumedAnalyzer::run().
Definition at line 183 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_TRAIT_WITH_PROGRAMSTATE().
Stmt * AnalysisDeclContext::getBody | ( | ) | const |
Get the body of the Declaration.
Definition at line 119 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 85 of file AnalysisDeclContext.cpp.
CFG * AnalysisDeclContext::getCFG | ( | ) |
Definition at line 206 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 111 of file AnalysisDeclContext.h.
Referenced by clang::reachable_code::FindUnreachableCode(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), and mayInlineCallKind().
|
inline |
Definition at line 115 of file AnalysisDeclContext.h.
CFGReverseBlockReachabilityAnalysis * AnalysisDeclContext::getCFGReachablityAnalysis | ( | ) |
Definition at line 256 of file AnalysisDeclContext.cpp.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
CFGStmtMap * AnalysisDeclContext::getCFGStmtMap | ( | ) |
Definition at line 244 of file AnalysisDeclContext.cpp.
References clang::CFGStmtMap::Build().
Referenced by findBlockForNode().
|
inline |
Definition at line 102 of file AnalysisDeclContext.h.
Referenced by CheckUnreachable(), DiagnoseSwitchLabelsFallthrough(), getLocationForCaller(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), clang::threadSafety::CFGWalker::init(), isDebuggingContext(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), LookThroughTransitiveAssignmentsAndCommaOperators(), mayInlineDecl(), and clang::consumed::ConsumedAnalyzer::run().
|
inline |
Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext.
Definition at line 106 of file AnalysisDeclContext.h.
ParentMap & AnalysisDeclContext::getParentMap | ( | ) |
Definition at line 272 of file AnalysisDeclContext.cpp.
References clang::C.
Referenced by clang::ento::AnalysisManager::getParentMap(), and clang::sema::AnalysisBasedWarnings::IssueWarnings().
PseudoConstantAnalysis * AnalysisDeclContext::getPseudoConstantAnalysis | ( | ) |
Definition at line 288 of file AnalysisDeclContext.cpp.
llvm::iterator_range< AnalysisDeclContext::referenced_decls_iterator > AnalysisDeclContext::getReferencedBlockVars | ( | const BlockDecl * | BD | ) |
Definition at line 570 of file AnalysisDeclContext.cpp.
References LazyInitializeReferencedDecls().
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 141 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 311 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 225 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 124 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 124 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 130 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 170 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::getParent(), clang::DeclContext::isStdNamespace(), and Parent.
Referenced by mayInlineDecl().
void AnalysisDeclContext::registerForcedBlockExpression | ( | const Stmt * | stmt | ) |
Definition at line 173 of file AnalysisDeclContext.cpp.
References clang::ast_matchers::stmt.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().