|
clang
5.0.0
|
AnalysisDeclContext contains the context data for the function or method under analysis. More...
#include "clang/Analysis/AnalysisContext.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 66 of file AnalysisContext.h.
| typedef const VarDecl* const* clang::AnalysisDeclContext::referenced_decls_iterator |
Definition at line 174 of file AnalysisContext.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 600 of file AnalysisDeclContext.cpp.
| void AnalysisDeclContext::dumpCFG | ( | bool | ShowColors | ) |
Definition at line 278 of file AnalysisDeclContext.cpp.
References clang::CFG::dump(), getASTContext(), and getCFG().
|
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 122 of file AnalysisContext.h.
References clang::CFG::BuildOptions::AddEHEdges.
Referenced by CheckFallThrough().
|
inline |
Definition at line 126 of file AnalysisContext.h.
References clang::CFG::BuildOptions::AddImplicitDtors.
|
inline |
Definition at line 127 of file AnalysisContext.h.
References clang::CFG::BuildOptions::AddInitializers.
|
inline |
Return the specified analysis object, lazily running the analysis if necessary.
Return NULL if the analysis could not run.
Definition at line 196 of file AnalysisContext.h.
References clang::serialized_diags::create().
Referenced by clang::ento::AnalysisManager::getAnalysis(), clang::LocationContext::getAnalysis(), clang::threadSafety::CFGWalker::init(), mayInlineDecl(), clang::consumed::ConsumedAnalyzer::run(), and clang::runUninitializedVariablesAnalysis().
|
inline |
Definition at line 100 of file AnalysisContext.h.
References clang::Decl::getASTContext().
Referenced by clang::ento::SValBuilder::conjureSymbolVal(), DiagnoseSwitchLabelsFallthrough(), dumpCFG(), clang::LocationContext::dumpStack(), getBody(), mayInlineDecl(), clang::consumed::ConsumedAnalyzer::run(), and clang::threadSafety::CFGWalker::walk().
Definition at line 193 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 325 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 129 of file AnalysisDeclContext.cpp.
Referenced by DiagnoseSwitchLabelsFallthrough(), getBody(), getCFG(), getLocationForCaller(), getParentMap(), getPseudoConstantAnalysis(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), getUnoptimizedCFG(), getValidSourceLocation(), isBodyAutosynthesized(), isBodyAutosynthesizedFromModelFile(), 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.
References getASTContext(), getBody(), getBodyFarm(), and clang::AnalysisDeclContextManager::synthesizeBodies().
| CFG * AnalysisDeclContext::getCFG | ( | ) |
Definition at line 216 of file AnalysisDeclContext.cpp.
References addParentsForSyntheticStmts(), clang::CFG::buildCFG(), clang::Decl::getASTContext(), getBody(), getCFGBuildOptions(), getUnoptimizedCFG(), clang::CFG::BuildOptions::Observer, and clang::CFG::BuildOptions::PruneTriviallyFalseEdges.
Referenced by clang::DominatorTree::buildDominatorTree(), CheckFallThrough(), checkRecursiveFunction(), checkThrowInNonThrowingFunc(), clang::LiveVariables::computeLiveness(), clang::PostOrderCFGView::create(), DiagnoseSwitchLabelsFallthrough(), dumpCFG(), clang::reachable_code::FindUnreachableCode(), clang::ento::AnalysisManager::getCFG(), clang::LocationContext::getCFG(), getCFGReachablityAnalysis(), getCFGStmtMap(), getParentMap(), 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 110 of file AnalysisContext.h.
Referenced by clang::reachable_code::FindUnreachableCode(), getCFG(), getUnoptimizedCFG(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), mayInlineCallKind(), and clang::ento::ExprEngine::VisitCXXConstructExpr().
|
inline |
Definition at line 114 of file AnalysisContext.h.
| CFGReverseBlockReachabilityAnalysis * AnalysisDeclContext::getCFGReachablityAnalysis | ( | ) |
Definition at line 266 of file AnalysisDeclContext.cpp.
References getCFG().
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
| CFGStmtMap * AnalysisDeclContext::getCFGStmtMap | ( | ) |
Definition at line 254 of file AnalysisDeclContext.cpp.
References clang::CFGStmtMap::Build(), getCFG(), and getParentMap().
Referenced by findBlockForNode().
|
inline |
Definition at line 101 of file AnalysisContext.h.
Referenced by CheckUnreachable(), DiagnoseSwitchLabelsFallthrough(), clang::threadSafety::CFGWalker::getDecl(), clang::LocationContext::getDecl(), getLocationForCaller(), getParentMap(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), getValidSourceLocation(), clang::threadSafety::CFGWalker::init(), isDebuggingContext(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), mayInlineDecl(), and clang::consumed::ConsumedAnalyzer::run().
|
inline |
Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext.
Definition at line 105 of file AnalysisContext.h.
| ParentMap & AnalysisDeclContext::getParentMap | ( | ) |
Definition at line 282 of file AnalysisDeclContext.cpp.
References addParentsForSyntheticStmts(), getBody(), getCFG(), getDecl(), getUnoptimizedCFG(), and I.
Referenced by getCFGStmtMap(), clang::ento::AnalysisManager::getParentMap(), clang::LocationContext::getParentMap(), getValidSourceLocation(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), and shouldRemoveDeadBindings().
| PseudoConstantAnalysis * AnalysisDeclContext::getPseudoConstantAnalysis | ( | ) |
Definition at line 298 of file AnalysisDeclContext.cpp.
References getBody().
| llvm::iterator_range< AnalysisDeclContext::referenced_decls_iterator > AnalysisDeclContext::getReferencedBlockVars | ( | const BlockDecl * | BD | ) |
Definition at line 578 of file AnalysisDeclContext.cpp.
References LazyInitializeReferencedDecls().
| const ImplicitParamDecl * AnalysisDeclContext::getSelfDecl | ( | ) | const |
Return the ImplicitParamDecl* associated with 'self' if this AnalysisDeclContext wraps an ObjCMethodDecl.
Returns NULL otherwise.
Definition at line 151 of file AnalysisDeclContext.cpp.
References clang::CXXRecordDecl::captures(), clang::DeclContext::getParent(), I, 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 319 of file AnalysisDeclContext.cpp.
References clang::LocationContextManager::getStackFrame().
Referenced by REGISTER_TRAIT_WITH_PROGRAMSTATE().
| CFG * AnalysisDeclContext::getUnoptimizedCFG | ( | ) |
Return a version of the CFG without any edges pruned.
Definition at line 235 of file AnalysisDeclContext.cpp.
References addParentsForSyntheticStmts(), clang::CFG::buildCFG(), clang::Decl::getASTContext(), getBody(), getCFGBuildOptions(), clang::CFG::BuildOptions::Observer, and clang::CFG::BuildOptions::PruneTriviallyFalseEdges.
Referenced by getCFG(), and getParentMap().
|
inline |
Definition at line 123 of file AnalysisContext.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 134 of file AnalysisDeclContext.cpp.
References getBody().
Referenced by clang::ento::BugReporter::emitReport(), findTopAutosynthesizedParentContext(), clang::ento::PathDiagnosticLocation::getStmt(), isSynthesizedAccessor(), 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 140 of file AnalysisDeclContext.cpp.
References getBody(), clang::Stmt::getLocStart(), and clang::SourceLocation::isValid().
Referenced by clang::ento::BugReporter::emitReport().
|
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 169 of file AnalysisContext.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 332 of file AnalysisDeclContext.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), clang::DeclContext::getParent(), and clang::DeclContext::isStdNamespace().
Referenced by clang::ento::LikelyFalsePositiveSuppressionBRVisitor::getEndPath(), isCPPStdLibraryFunction(), and mayInlineDecl().
| void AnalysisDeclContext::registerForcedBlockExpression | ( | const Stmt * | stmt | ) |
Definition at line 183 of file AnalysisDeclContext.cpp.
References clang::ast_matchers::stmt.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
1.8.6