clang API Documentation
#include <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 |
CFG::BuildOptions & | getCFGBuildOptions () |
Return the build options used to construct the CFG. | |
const CFG::BuildOptions & | getCFGBuildOptions () const |
bool | getAddEHEdges () const |
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. | |
Stmt * | getBody (bool &IsAutosynthesized) const |
Get the body of the Declaration. | |
bool | isBodyAutosynthesized () const |
Checks if the body of the Decl is generated by the BodyFarm. | |
bool | isBodyAutosynthesizedFromModelFile () const |
Checks if the body of the Decl is generated by the BodyFarm from a model file. | |
CFG * | getCFG () |
CFGStmtMap * | getCFGStmtMap () |
CFGReverseBlockReachabilityAnalysis * | getCFGReachablityAnalysis () |
CFG * | getUnoptimizedCFG () |
Return a version of the CFG without any edges pruned. | |
void | dumpCFG (bool ShowColors) |
bool | isCFGBuilt () const |
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. | |
ParentMap & | getParentMap () |
PseudoConstantAnalysis * | getPseudoConstantAnalysis () |
std::pair < referenced_decls_iterator, referenced_decls_iterator > | getReferencedBlockVars (const BlockDecl *BD) |
const ImplicitParamDecl * | getSelfDecl () const |
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 () |
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.
Definition at line 556 of file AnalysisDeclContext.cpp.
void AnalysisDeclContext::dumpCFG | ( | bool | ShowColors | ) |
Definition at line 249 of file AnalysisDeclContext.cpp.
References clang::CFG::dump(), getASTContext(), and getCFG().
bool clang::AnalysisDeclContext::getAddEHEdges | ( | ) | const [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().
bool clang::AnalysisDeclContext::getAddImplicitDtors | ( | ) | const [inline] |
Definition at line 126 of file AnalysisContext.h.
References clang::CFG::BuildOptions::AddImplicitDtors.
bool clang::AnalysisDeclContext::getAddInitializers | ( | ) | const [inline] |
Definition at line 127 of file AnalysisContext.h.
References clang::CFG::BuildOptions::AddInitializers.
T* clang::AnalysisDeclContext::getAnalysis | ( | ) | [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(), and data().
Referenced by clang::ento::AnalysisManager::getAnalysis(), clang::LocationContext::getAnalysis(), clang::threadSafety::CFGWalker::init(), mayInlineDecl(), clang::consumed::ConsumedAnalyzer::run(), and clang::runUninitializedVariablesAnalysis().
ASTContext& clang::AnalysisDeclContext::getASTContext | ( | ) | const [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(), clang::threadSafety::ThreadSafetyAnalyzer::runAnalysis(), and clang::threadSafety::CFGWalker::walk().
const CFGBlock * AnalysisDeclContext::getBlockForRegisteredExpression | ( | const Stmt * | stmt | ) |
Definition at line 164 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 296 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 121 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().
Stmt * AnalysisDeclContext::getBody | ( | bool & | IsAutosynthesized | ) | const |
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().
Definition at line 187 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(), 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().
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(), and mayInlineCallKind().
const CFG::BuildOptions& clang::AnalysisDeclContext::getCFGBuildOptions | ( | ) | const [inline] |
Definition at line 114 of file AnalysisContext.h.
Definition at line 237 of file AnalysisDeclContext.cpp.
References getCFG().
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
Definition at line 225 of file AnalysisDeclContext.cpp.
References clang::CFGStmtMap::Build(), getCFG(), and getParentMap().
const Decl* clang::AnalysisDeclContext::getDecl | ( | ) | const [inline] |
Definition at line 101 of file AnalysisContext.h.
Referenced by CheckUnreachable(), clang::threadSafety::CFGWalker::getDecl(), clang::LocationContext::getDecl(), getLocationForCaller(), getParentMap(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), getValidSourceLocation(), clang::threadSafety::CFGWalker::init(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), mayInlineDecl(), and clang::consumed::ConsumedAnalyzer::run().
AnalysisDeclContextManager* clang::AnalysisDeclContext::getManager | ( | ) | const [inline] |
Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext.
Definition at line 105 of file AnalysisContext.h.
Definition at line 253 of file AnalysisDeclContext.cpp.
References addParentsForSyntheticStmts(), AttributeLangSupport::C, getBody(), getCFG(), getDecl(), and getUnoptimizedCFG().
Referenced by getCFGStmtMap(), clang::ento::AnalysisManager::getParentMap(), clang::LocationContext::getParentMap(), getValidSourceLocation(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), and shouldRemoveDeadBindings().
Definition at line 269 of file AnalysisDeclContext.cpp.
References getBody().
std::pair< AnalysisDeclContext::referenced_decls_iterator, AnalysisDeclContext::referenced_decls_iterator > AnalysisDeclContext::getReferencedBlockVars | ( | const BlockDecl * | BD | ) |
Definition at line 535 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 139 of file AnalysisDeclContext.cpp.
References clang::NamedDecl::getName().
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 290 of file AnalysisDeclContext.cpp.
References clang::LocationContextManager::getStackFrame().
Referenced by REGISTER_TRAIT_WITH_PROGRAMSTATE().
Return a version of the CFG without any edges pruned.
Definition at line 206 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().
bool clang::AnalysisDeclContext::getUseUnoptimizedCFG | ( | ) | const [inline] |
Definition at line 123 of file AnalysisContext.h.
References clang::CFG::BuildOptions::PruneTriviallyFalseEdges.
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 126 of file AnalysisDeclContext.cpp.
References getBody().
Referenced by clang::ento::BugReporter::emitReport(), and wasSynthesizedProperty().
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 132 of file AnalysisDeclContext.cpp.
References getBody(), clang::Stmt::getLocStart(), and clang::SourceLocation::isValid().
Referenced by clang::ento::BugReporter::emitReport().
bool clang::AnalysisDeclContext::isCFGBuilt | ( | ) | const [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().
void AnalysisDeclContext::registerForcedBlockExpression | ( | const Stmt * | stmt | ) |
Definition at line 154 of file AnalysisDeclContext.cpp.
References clang::ast_matchers::stmt.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().