clang API Documentation
Retains information about a function, method, or block that is currently being parsed. More...
#include <ScopeInfo.h>
Classes | |
class | WeakObjectProfileTy |
class | WeakUseTy |
Public Types | |
typedef SmallVector< WeakUseTy, 4 > | WeakUseVector |
typedef llvm::SmallDenseMap < WeakObjectProfileTy, WeakUseVector, 8, WeakObjectProfileTy::DenseMapInfo > | WeakObjectUseMap |
Public Member Functions | |
template<typename ExprT > | |
void | recordUseOfWeak (const ExprT *E, bool IsRead=true) |
void | recordUseOfWeak (const ObjCMessageExpr *Msg, const ObjCPropertyDecl *Prop) |
void | markSafeWeakUse (const Expr *E) |
const WeakObjectUseMap & | getWeakObjectUses () const |
void | setHasBranchIntoScope () |
void | setHasBranchProtectedScope () |
void | setHasIndirectGoto () |
void | setHasDroppedStmt () |
bool | NeedsScopeChecking () const |
FunctionScopeInfo (DiagnosticsEngine &Diag) | |
virtual | ~FunctionScopeInfo () |
void | Clear () |
Clear out the information in this function scope, making it suitable for reuse. | |
Public Attributes | |
ScopeKind | Kind |
What kind of scope we are describing. | |
bool | HasBranchProtectedScope |
Whether this function contains a VLA, @try, try, C++ initializer, or anything else that can't be jumped past. | |
bool | HasBranchIntoScope |
Whether this function contains any switches or direct gotos. | |
bool | HasIndirectGoto |
Whether this function contains any indirect gotos. | |
bool | HasDroppedStmt |
Whether a statement was dropped because it was invalid. | |
bool | ObjCShouldCallSuper |
bool | ObjCIsDesignatedInit |
True when this is a method marked as a designated initializer. | |
bool | ObjCWarnForNoDesignatedInitChain |
bool | ObjCIsSecondaryInit |
bool | ObjCWarnForNoInitDelegation |
DiagnosticErrorTrap | ErrorTrap |
Used to determine if errors occurred in this function or block. | |
SmallVector< SwitchStmt *, 8 > | SwitchStack |
SmallVector< ReturnStmt *, 4 > | Returns |
The list of return statements that occur within the function or block, if there is any chance of applying the named return value optimization, or if we need to infer a return type. | |
SmallVector< CompoundScopeInfo, 4 > | CompoundScopes |
The stack of currently active compound stamement scopes in the function. | |
SmallVector < PossiblyUnreachableDiag, 4 > | PossiblyUnreachableDiags |
A list of PartialDiagnostics created but delayed within the current function scope. These diagnostics are vetted for reachability prior to being emitted. | |
Protected Types | |
enum | ScopeKind { SK_Function, SK_Block, SK_Lambda, SK_CapturedRegion } |
Retains information about a function, method, or block that is currently being parsed.
Definition at line 80 of file ScopeInfo.h.
typedef llvm::SmallDenseMap<WeakObjectProfileTy, WeakUseVector, 8, WeakObjectProfileTy::DenseMapInfo> clang::sema::FunctionScopeInfo::WeakObjectUseMap |
Used to collect all uses of weak objects in a function body.
Part of the implementation of -Wrepeated-use-of-weak.
Definition at line 276 of file ScopeInfo.h.
typedef SmallVector<WeakUseTy, 4> clang::sema::FunctionScopeInfo::WeakUseVector |
Used to collect uses of a particular weak object in a function body.
Part of the implementation of -Wrepeated-use-of-weak.
Definition at line 269 of file ScopeInfo.h.
enum clang::sema::FunctionScopeInfo::ScopeKind [protected] |
Definition at line 82 of file ScopeInfo.h.
clang::sema::FunctionScopeInfo::FunctionScopeInfo | ( | DiagnosticsEngine & | Diag | ) | [inline] |
Definition at line 326 of file ScopeInfo.h.
FunctionScopeInfo::~FunctionScopeInfo | ( | ) | [virtual] |
Definition at line 230 of file ScopeInfo.cpp.
void FunctionScopeInfo::Clear | ( | ) |
Clear out the information in this function scope, making it suitable for reuse.
Definition at line 26 of file ScopeInfo.cpp.
References ErrorTrap, HasBranchIntoScope, HasBranchProtectedScope, HasDroppedStmt, HasIndirectGoto, ObjCIsDesignatedInit, ObjCIsSecondaryInit, ObjCShouldCallSuper, ObjCWarnForNoDesignatedInitChain, ObjCWarnForNoInitDelegation, PossiblyUnreachableDiags, clang::DiagnosticErrorTrap::reset(), Returns, and SwitchStack.
const WeakObjectUseMap& clang::sema::FunctionScopeInfo::getWeakObjectUses | ( | ) | const [inline] |
Definition at line 300 of file ScopeInfo.h.
Referenced by diagnoseRepeatedUseOfWeak().
void FunctionScopeInfo::markSafeWeakUse | ( | const Expr * | E | ) |
Record that a given expression is a "safe" access of a weak object (e.g. assigning it to a strong variable.)
Part of the implementation of -Wrepeated-use-of-weak.
Definition at line 154 of file ScopeInfo.cpp.
References clang::ObjCPropertyDecl::findPropertyDecl(), clang::PseudoObjectExpr::getSyntacticForm(), and clang::Expr::IgnoreParenCasts().
bool clang::sema::FunctionScopeInfo::NeedsScopeChecking | ( | ) | const [inline] |
Definition at line 320 of file ScopeInfo.h.
References HasBranchIntoScope, HasBranchProtectedScope, HasDroppedStmt, and HasIndirectGoto.
void clang::sema::FunctionScopeInfo::recordUseOfWeak | ( | const ExprT * | E, |
bool | IsRead = true |
||
) | [inline] |
Record that a weak object was accessed.
Part of the implementation of -Wrepeated-use-of-weak.
Definition at line 813 of file ScopeInfo.h.
Referenced by clang::Sema::BuildInstanceMessage(), and clang::Sema::recordUseOfEvaluatedWeak().
void FunctionScopeInfo::recordUseOfWeak | ( | const ObjCMessageExpr * | Msg, |
const ObjCPropertyDecl * | Prop | ||
) |
Definition at line 146 of file ScopeInfo.cpp.
References clang::ObjCMessageExpr::getInstanceReceiver(), and clang::ObjCMessageExpr::getNumArgs().
void clang::sema::FunctionScopeInfo::setHasBranchIntoScope | ( | ) | [inline] |
Definition at line 304 of file ScopeInfo.h.
References HasBranchIntoScope.
void clang::sema::FunctionScopeInfo::setHasBranchProtectedScope | ( | ) | [inline] |
Definition at line 308 of file ScopeInfo.h.
References HasBranchProtectedScope.
Referenced by clang::Sema::ActOnOpenMPAtomicDirective(), clang::Sema::ActOnOpenMPCriticalDirective(), clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPMasterDirective(), clang::Sema::ActOnOpenMPOrderedDirective(), clang::Sema::ActOnOpenMPParallelDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), clang::Sema::ActOnOpenMPParallelSectionsDirective(), clang::Sema::ActOnOpenMPSectionDirective(), clang::Sema::ActOnOpenMPSectionsDirective(), clang::Sema::ActOnOpenMPSimdDirective(), clang::Sema::ActOnOpenMPSingleDirective(), clang::Sema::ActOnOpenMPTargetDirective(), clang::Sema::ActOnOpenMPTaskDirective(), and clang::Sema::ActOnOpenMPTeamsDirective().
void clang::sema::FunctionScopeInfo::setHasDroppedStmt | ( | ) | [inline] |
Definition at line 316 of file ScopeInfo.h.
References HasDroppedStmt.
void clang::sema::FunctionScopeInfo::setHasIndirectGoto | ( | ) | [inline] |
Definition at line 312 of file ScopeInfo.h.
References HasIndirectGoto.
SmallVector<CompoundScopeInfo, 4> clang::sema::FunctionScopeInfo::CompoundScopes |
The stack of currently active compound stamement scopes in the function.
Definition at line 141 of file ScopeInfo.h.
Referenced by clang::Sema::PopCompoundScope(), and clang::Sema::PushCompoundScope().
Used to determine if errors occurred in this function or block.
Definition at line 128 of file ScopeInfo.h.
Referenced by Clear(), and clang::Sema::hasAnyUnrecoverableErrorsInThisFunction().
Whether this function contains any switches or direct gotos.
Definition at line 99 of file ScopeInfo.h.
Referenced by Clear(), NeedsScopeChecking(), and setHasBranchIntoScope().
Whether this function contains a VLA, @try, try, C++ initializer, or anything else that can't be jumped past.
Definition at line 96 of file ScopeInfo.h.
Referenced by Clear(), NeedsScopeChecking(), and setHasBranchProtectedScope().
Whether a statement was dropped because it was invalid.
Definition at line 105 of file ScopeInfo.h.
Referenced by Clear(), NeedsScopeChecking(), and setHasDroppedStmt().
Whether this function contains any indirect gotos.
Definition at line 102 of file ScopeInfo.h.
Referenced by Clear(), NeedsScopeChecking(), and setHasIndirectGoto().
What kind of scope we are describing.
Definition at line 92 of file ScopeInfo.h.
Referenced by clang::sema::CapturingScopeInfo::classof(), clang::sema::BlockScopeInfo::classof(), clang::sema::CapturedRegionScopeInfo::classof(), and clang::sema::LambdaScopeInfo::classof().
True when this is a method marked as a designated initializer.
Definition at line 113 of file ScopeInfo.h.
Referenced by clang::Sema::ActOnStartOfObjCMethodDef(), clang::Sema::BuildInstanceMessage(), and Clear().
True when this is an initializer method not marked as a designated initializer within a class that has at least one initializer marked as a designated initializer.
Definition at line 122 of file ScopeInfo.h.
Referenced by clang::Sema::ActOnStartOfObjCMethodDef(), clang::Sema::BuildInstanceMessage(), and Clear().
A flag that is set when parsing a method that must call super's implementation, such as -dealloc
, -finalize
, or any method marked with __attribute__
((objc_requires_super)).
Definition at line 110 of file ScopeInfo.h.
Referenced by clang::Sema::ActOnStartOfObjCMethodDef(), clang::Sema::ActOnSuperMessage(), and Clear().
This starts true for a method marked as designated initializer and will be set to false if there is an invocation to a designated initializer of the super class.
Definition at line 117 of file ScopeInfo.h.
Referenced by clang::Sema::ActOnStartOfObjCMethodDef(), clang::Sema::BuildInstanceMessage(), and Clear().
This starts true for a secondary initializer method and will be set to false if there is an invocation of an initializer on 'self'.
Definition at line 125 of file ScopeInfo.h.
Referenced by clang::Sema::ActOnStartOfObjCMethodDef(), clang::Sema::BuildInstanceMessage(), and Clear().
A list of PartialDiagnostics created but delayed within the current function scope. These diagnostics are vetted for reachability prior to being emitted.
Definition at line 146 of file ScopeInfo.h.
Referenced by Clear(), flushDiagnostics(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), and clang::Sema::PopFunctionScopeInfo().
SmallVector<ReturnStmt*, 4> clang::sema::FunctionScopeInfo::Returns |
The list of return statements that occur within the function or block, if there is any chance of applying the named return value optimization, or if we need to infer a return type.
Definition at line 137 of file ScopeInfo.h.
Referenced by Clear(), clang::Sema::computeNRVO(), and clang::Sema::deduceClosureReturnType().
SmallVector<SwitchStmt*, 8> clang::sema::FunctionScopeInfo::SwitchStack |
SwitchStack - This is the current set of active switch statements in the block.
Definition at line 132 of file ScopeInfo.h.
Referenced by AddKeywordsToConsumer(), AddOrdinaryNameResults(), Clear(), and handleFallThroughAttr().