clang  6.0.0svn
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 "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 ()
 
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_iteratorgetReferencedBlockVars (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 AnalysisDeclContext.h.

Member Typedef Documentation

◆ referenced_decls_iterator

Definition at line 174 of file AnalysisDeclContext.h.

Constructor & Destructor Documentation

◆ AnalysisDeclContext() [1/2]

AnalysisDeclContext::AnalysisDeclContext ( AnalysisDeclContextManager Mgr,
const Decl D 
)

Definition at line 53 of file AnalysisDeclContext.cpp.

References clang::CFG::BuildOptions::forcedBlkExprs.

◆ AnalysisDeclContext() [2/2]

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::~AnalysisDeclContext ( )

Definition at line 602 of file AnalysisDeclContext.cpp.

Member Function Documentation

◆ dumpCFG()

void AnalysisDeclContext::dumpCFG ( bool  ShowColors)

Definition at line 280 of file AnalysisDeclContext.cpp.

◆ getAddEHEdges()

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 AnalysisDeclContext.h.

References clang::CFG::BuildOptions::AddEHEdges.

Referenced by CheckFallThrough().

◆ getAddImplicitDtors()

bool clang::AnalysisDeclContext::getAddImplicitDtors ( ) const
inline

Definition at line 126 of file AnalysisDeclContext.h.

References clang::CFG::BuildOptions::AddImplicitDtors.

◆ getAddInitializers()

bool clang::AnalysisDeclContext::getAddInitializers ( ) const
inline

◆ getAnalysis()

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

◆ getASTContext()

ASTContext& clang::AnalysisDeclContext::getASTContext ( ) const
inline

◆ getBlockForRegisteredExpression()

const CFGBlock * AnalysisDeclContext::getBlockForRegisteredExpression ( const Stmt stmt)

◆ getBlockInvocationContext()

const BlockInvocationContext * AnalysisDeclContext::getBlockInvocationContext ( const LocationContext parent,
const BlockDecl BD,
const void *  ContextData 
)

◆ getBody() [1/2]

Stmt * AnalysisDeclContext::getBody ( ) const

◆ getBody() [2/2]

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

References getBodyFarm().

◆ getCFG()

CFG * AnalysisDeclContext::getCFG ( )

◆ getCFGBuildOptions() [1/2]

CFG::BuildOptions& clang::AnalysisDeclContext::getCFGBuildOptions ( )
inline

Return the build options used to construct the CFG.

Definition at line 110 of file AnalysisDeclContext.h.

Referenced by clang::reachable_code::FindUnreachableCode(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), and mayInlineCallKind().

◆ getCFGBuildOptions() [2/2]

const CFG::BuildOptions& clang::AnalysisDeclContext::getCFGBuildOptions ( ) const
inline

Definition at line 114 of file AnalysisDeclContext.h.

◆ getCFGReachablityAnalysis()

CFGReverseBlockReachabilityAnalysis * AnalysisDeclContext::getCFGReachablityAnalysis ( )

◆ getCFGStmtMap()

CFGStmtMap * AnalysisDeclContext::getCFGStmtMap ( )

Definition at line 256 of file AnalysisDeclContext.cpp.

References clang::CFGStmtMap::Build().

Referenced by findBlockForNode().

◆ getDecl()

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

◆ getManager()

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

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

Definition at line 105 of file AnalysisDeclContext.h.

◆ getParentMap()

ParentMap & AnalysisDeclContext::getParentMap ( )

◆ getPseudoConstantAnalysis()

PseudoConstantAnalysis * AnalysisDeclContext::getPseudoConstantAnalysis ( )

Definition at line 300 of file AnalysisDeclContext.cpp.

◆ getReferencedBlockVars()

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

◆ getSelfDecl()

const ImplicitParamDecl * AnalysisDeclContext::getSelfDecl ( ) const

Return the ImplicitParamDecl* associated with 'self' if this AnalysisDeclContext wraps an ObjCMethodDecl.

Returns NULL otherwise.

Definition at line 153 of file AnalysisDeclContext.cpp.

Referenced by clang::ObjCMethodCall::getInitialStackFrameContents(), clang::LocationContext::getSelfDecl(), and isSelfVar().

◆ getStackFrame()

const StackFrameContext * AnalysisDeclContext::getStackFrame ( LocationContext const *  Parent,
const Stmt S,
const CFGBlock Blk,
unsigned  Idx 
)

Definition at line 321 of file AnalysisDeclContext.cpp.

Referenced by REGISTER_TRAIT_WITH_PROGRAMSTATE().

◆ getUnoptimizedCFG()

CFG * AnalysisDeclContext::getUnoptimizedCFG ( )

◆ getUseUnoptimizedCFG()

bool clang::AnalysisDeclContext::getUseUnoptimizedCFG ( ) const
inline

◆ isBodyAutosynthesized()

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

Referenced by findTopAutosynthesizedParentContext(), clang::ento::PathDiagnosticLocation::getStmt(), isSynthesizedAccessor(), mayInlineDecl(), and clang::ento::PathDiagnosticCallPiece::setCallee().

◆ isBodyAutosynthesizedFromModelFile()

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

References clang::Stmt::getLocStart(), and clang::SourceLocation::isValid().

◆ isCFGBuilt()

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 AnalysisDeclContext.h.

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

◆ isInStdNamespace()

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

References clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), clang::DeclContext::getParent(), clang::DeclContext::isStdNamespace(), and Parent.

Referenced by mayInlineDecl().

◆ registerForcedBlockExpression()

void AnalysisDeclContext::registerForcedBlockExpression ( const Stmt stmt)

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