clang  3.9.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::AnalysisDeclContext Class Reference

AnalysisDeclContext contains the context data for the function or method under analysis. More...

#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 ()
 
ASTContextgetASTContext () const
 
const DeclgetDecl () const
 
AnalysisDeclContextManagergetManager () const
 Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext. More...
 
CFG::BuildOptionsgetCFGBuildOptions ()
 Return the build options used to construct the CFG. More...
 
const CFG::BuildOptionsgetCFGBuildOptions () 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 CFGBlockgetBlockForRegisteredExpression (const Stmt *stmt)
 
StmtgetBody () const
 Get the body of the Declaration. More...
 
StmtgetBody (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...
 
CFGgetCFG ()
 
CFGStmtMapgetCFGStmtMap ()
 
CFGReverseBlockReachabilityAnalysisgetCFGReachablityAnalysis ()
 
CFGgetUnoptimizedCFG ()
 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...
 
ParentMapgetParentMap ()
 
PseudoConstantAnalysisgetPseudoConstantAnalysis ()
 
llvm::iterator_range
< referenced_decls_iterator
getReferencedBlockVars (const BlockDecl *BD)
 
const ImplicitParamDeclgetSelfDecl () const
 Return the ImplicitParamDecl* associated with 'self' if this AnalysisDeclContext wraps an ObjCMethodDecl. More...
 
const StackFrameContextgetStackFrame (LocationContext const *Parent, const Stmt *S, const CFGBlock *Blk, unsigned Idx)
 
const BlockInvocationContextgetBlockInvocationContext (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...
 

Detailed Description

AnalysisDeclContext contains the context data for the function or method under analysis.

Definition at line 66 of file AnalysisContext.h.

Member Typedef Documentation

Definition at line 174 of file AnalysisContext.h.

Constructor & Destructor Documentation

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 598 of file AnalysisDeclContext.cpp.

Member Function Documentation

void AnalysisDeclContext::dumpCFG ( bool  ShowColors)

Definition at line 276 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.

template<typename T >
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().

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
const CFGBlock * AnalysisDeclContext::getBlockForRegisteredExpression ( const Stmt stmt)
const BlockInvocationContext * AnalysisDeclContext::getBlockInvocationContext ( const LocationContext parent,
const BlockDecl BD,
const void *  ContextData 
)
Stmt * AnalysisDeclContext::getBody ( ) const
Stmt * AnalysisDeclContext::getBody ( bool IsAutosynthesized) const

Get the body of the Declaration.

Parameters
[out]IsAutosynthesizedSpecifies 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 ( )
CFG::BuildOptions& clang::AnalysisDeclContext::getCFGBuildOptions ( )
inline
const CFG::BuildOptions& clang::AnalysisDeclContext::getCFGBuildOptions ( ) const
inline

Definition at line 114 of file AnalysisContext.h.

CFGReverseBlockReachabilityAnalysis * AnalysisDeclContext::getCFGReachablityAnalysis ( )

Definition at line 264 of file AnalysisDeclContext.cpp.

References getCFG().

Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().

CFGStmtMap * AnalysisDeclContext::getCFGStmtMap ( )

Definition at line 252 of file AnalysisDeclContext.cpp.

References clang::CFGStmtMap::Build(), getCFG(), and getParentMap().

const Decl* clang::AnalysisDeclContext::getDecl ( ) const
inline
AnalysisDeclContextManager* clang::AnalysisDeclContext::getManager ( ) const
inline

Return the AnalysisDeclContextManager (if any) that created this AnalysisDeclContext.

Definition at line 105 of file AnalysisContext.h.

ParentMap & AnalysisDeclContext::getParentMap ( )
PseudoConstantAnalysis * AnalysisDeclContext::getPseudoConstantAnalysis ( )

Definition at line 296 of file AnalysisDeclContext.cpp.

References getBody().

llvm::iterator_range< AnalysisDeclContext::referenced_decls_iterator > AnalysisDeclContext::getReferencedBlockVars ( const BlockDecl BD)

Definition at line 576 of file AnalysisDeclContext.cpp.

References LazyInitializeReferencedDecls().

const ImplicitParamDecl * AnalysisDeclContext::getSelfDecl ( ) const
const StackFrameContext * AnalysisDeclContext::getStackFrame ( LocationContext const *  Parent,
const Stmt S,
const CFGBlock Blk,
unsigned  Idx 
)
CFG * AnalysisDeclContext::getUnoptimizedCFG ( )
bool clang::AnalysisDeclContext::getUseUnoptimizedCFG ( ) const
inline
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.

See Also
getBody

Definition at line 132 of file AnalysisDeclContext.cpp.

References getBody().

Referenced by clang::ento::BugReporter::emitReport(), and isSynthesizedAccessor().

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.

See Also
getBody

Definition at line 138 of file AnalysisDeclContext.cpp.

References getBody().

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().

bool AnalysisDeclContext::isInStdNamespace ( const Decl D)
static

Returns true if the root namespace of the given declaration is the 'std' C++ namespace.

Definition at line 330 of file AnalysisDeclContext.cpp.

References clang::DeclContext::getParent(), and clang::DeclContext::isStdNamespace().

Referenced by clang::ento::LikelyFalsePositiveSuppressionBRVisitor::getEndPath(), isCPPStdLibraryFunction(), and mayInlineDecl().

void AnalysisDeclContext::registerForcedBlockExpression ( const Stmt stmt)

The documentation for this class was generated from the following files: