clang  3.9.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
clang::sema::CapturingScopeInfo Class Reference

#include <ScopeInfo.h>

Inheritance diagram for clang::sema::CapturingScopeInfo:
[legend]
Collaboration diagram for clang::sema::CapturingScopeInfo:
[legend]

Classes

class  Capture
 

Public Types

enum  ImplicitCaptureStyle {
  ImpCap_None, ImpCap_LambdaByval, ImpCap_LambdaByref, ImpCap_Block,
  ImpCap_CapturedRegion
}
 
- Public Types inherited from clang::sema::FunctionScopeInfo
typedef SmallVector< WeakUseTy, 4 > WeakUseVector
 Used to collect uses of a particular weak object in a function body. More...
 
typedef llvm::SmallDenseMap
< WeakObjectProfileTy,
WeakUseVector,
8, WeakObjectProfileTy::DenseMapInfo
WeakObjectUseMap
 Used to collect all uses of weak objects in a function body. More...
 

Public Member Functions

 CapturingScopeInfo (DiagnosticsEngine &Diag, ImplicitCaptureStyle Style)
 
void addCapture (VarDecl *Var, bool isBlock, bool isByref, bool isNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, Expr *Cpy)
 
void addVLATypeCapture (SourceLocation Loc, QualType CaptureType)
 
void addThisCapture (bool isNested, SourceLocation Loc, Expr *Cpy, bool ByCopy)
 
bool isCXXThisCaptured () const
 Determine whether the C++ 'this' is captured. More...
 
CapturegetCXXThisCapture ()
 Retrieve the capture of C++ 'this', if it has been captured. More...
 
bool isCaptured (VarDecl *Var) const
 Determine whether the given variable has been captured. More...
 
bool isVLATypeCaptured (const VariableArrayType *VAT) const
 Determine whether the given variable-array type has been captured. More...
 
CapturegetCapture (VarDecl *Var)
 Retrieve the capture of the given variable, if it has been captured already. More...
 
const CapturegetCapture (VarDecl *Var) const
 
- Public Member Functions inherited from clang::sema::FunctionScopeInfo
template<typename ExprT >
void recordUseOfWeak (const ExprT *E, bool IsRead=true)
 Record that a weak object was accessed. More...
 
void recordUseOfWeak (const ObjCMessageExpr *Msg, const ObjCPropertyDecl *Prop)
 
void markSafeWeakUse (const Expr *E)
 Record that a given expression is a "safe" access of a weak object (e.g. More...
 
const WeakObjectUseMapgetWeakObjectUses () const
 
void setHasBranchIntoScope ()
 
void setHasBranchProtectedScope ()
 
void setHasIndirectGoto ()
 
void setHasDroppedStmt ()
 
void setHasOMPDeclareReductionCombiner ()
 
void setHasFallthroughStmt ()
 
void setHasCXXTry (SourceLocation TryLoc)
 
void setHasSEHTry (SourceLocation TryLoc)
 
bool NeedsScopeChecking () const
 
 FunctionScopeInfo (DiagnosticsEngine &Diag)
 
virtual ~FunctionScopeInfo ()
 
void Clear ()
 Clear out the information in this function scope, making it suitable for reuse. More...
 

Static Public Member Functions

static bool classof (const FunctionScopeInfo *FSI)
 

Public Attributes

ImplicitCaptureStyle ImpCaptureStyle
 
llvm::DenseMap< VarDecl
*, unsigned
CaptureMap
 CaptureMap - A map of captured variables to (index+1) into Captures. More...
 
unsigned CXXThisCaptureIndex
 CXXThisCaptureIndex - The (index+1) of the capture of 'this'; zero if 'this' is not captured. More...
 
SmallVector< Capture, 4 > Captures
 Captures - The captures. More...
 
bool HasImplicitReturnType
 
  • Whether the target type of return statements in this context is deduced (e.g.
More...
 
QualType ReturnType
 ReturnType - The target type of return statements in this context, or null if unknown. More...
 
- Public Attributes inherited from clang::sema::FunctionScopeInfo
ScopeKind Kind: 3
 What kind of scope we are describing. More...
 
bool HasBranchProtectedScope: 1
 Whether this function contains a VLA, @try, try, C++ initializer, or anything else that can't be jumped past. More...
 
bool HasBranchIntoScope: 1
 Whether this function contains any switches or direct gotos. More...
 
bool HasIndirectGoto: 1
 Whether this function contains any indirect gotos. More...
 
bool HasDroppedStmt: 1
 Whether a statement was dropped because it was invalid. More...
 
bool HasOMPDeclareReductionCombiner
 True if current scope is for OpenMP declare reduction combiner. More...
 
bool HasFallthroughStmt: 1
 Whether there is a fallthrough statement in this function. More...
 
bool ObjCShouldCallSuper: 1
 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)). More...
 
bool ObjCIsDesignatedInit: 1
 True when this is a method marked as a designated initializer. More...
 
bool ObjCWarnForNoDesignatedInitChain: 1
 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. More...
 
bool ObjCIsSecondaryInit: 1
 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. More...
 
bool ObjCWarnForNoInitDelegation: 1
 This starts true for a secondary initializer method and will be set to false if there is an invocation of an initializer on 'self'. More...
 
SourceLocation FirstReturnLoc
 First 'return' statement in the current function. More...
 
SourceLocation FirstCXXTryLoc
 First C++ 'try' statement in the current function. More...
 
SourceLocation FirstSEHTryLoc
 First SEH '__try' statement in the current function. More...
 
DiagnosticErrorTrap ErrorTrap
 Used to determine if errors occurred in this function or block. More...
 
SmallVector< SwitchStmt *, 8 > SwitchStack
 SwitchStack - This is the current set of active switch statements in the block. More...
 
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. More...
 
VarDeclCoroutinePromise
 The promise object for this coroutine, if any. More...
 
SmallVector< Stmt *, 4 > CoroutineStmts
 The list of coroutine control flow constructs (co_await, co_yield, co_return) that occur within the function or block. More...
 
SmallVector< CompoundScopeInfo, 4 > CompoundScopes
 The stack of currently active compound stamement scopes in the function. More...
 
SmallVector
< PossiblyUnreachableDiag, 4 > 
PossiblyUnreachableDiags
 A list of PartialDiagnostics created but delayed within the current function scope. More...
 
llvm::SmallPtrSet< const
ParmVarDecl *, 8 > 
ModifiedNonNullParams
 A list of parameters which have the nonnull attribute and are modified in the function. More...
 

Protected Member Functions

 CapturingScopeInfo (const CapturingScopeInfo &)=default
 
- Protected Member Functions inherited from clang::sema::FunctionScopeInfo
 FunctionScopeInfo (const FunctionScopeInfo &)=default
 

Additional Inherited Members

- Protected Types inherited from clang::sema::FunctionScopeInfo
enum  ScopeKind { SK_Function, SK_Block, SK_Lambda, SK_CapturedRegion }
 

Detailed Description

Definition at line 398 of file ScopeInfo.h.

Member Enumeration Documentation

Enumerator
ImpCap_None 
ImpCap_LambdaByval 
ImpCap_LambdaByref 
ImpCap_Block 
ImpCap_CapturedRegion 

Definition at line 403 of file ScopeInfo.h.

Constructor & Destructor Documentation

clang::sema::CapturingScopeInfo::CapturingScopeInfo ( const CapturingScopeInfo )
protecteddefault
clang::sema::CapturingScopeInfo::CapturingScopeInfo ( DiagnosticsEngine Diag,
ImplicitCaptureStyle  Style 
)
inline

Definition at line 515 of file ScopeInfo.h.

Member Function Documentation

void clang::sema::CapturingScopeInfo::addCapture ( VarDecl Var,
bool  isBlock,
bool  isByref,
bool  isNested,
SourceLocation  Loc,
SourceLocation  EllipsisLoc,
QualType  CaptureType,
Expr Cpy 
)
inline
void clang::sema::CapturingScopeInfo::addThisCapture ( bool  isNested,
SourceLocation  Loc,
Expr Cpy,
bool  ByCopy 
)
inline

Definition at line 877 of file ScopeInfo.h.

Referenced by clang::Sema::CheckCXXThisCapture(), and RebuildLambdaScopeInfo().

void clang::sema::CapturingScopeInfo::addVLATypeCapture ( SourceLocation  Loc,
QualType  CaptureType 
)
inline

Definition at line 546 of file ScopeInfo.h.

References Captures.

Referenced by captureVariablyModifiedType(), and RebuildLambdaScopeInfo().

static bool clang::sema::CapturingScopeInfo::classof ( const FunctionScopeInfo FSI)
inlinestatic
Capture& clang::sema::CapturingScopeInfo::getCapture ( VarDecl Var)
inline

Retrieve the capture of the given variable, if it has been captured already.

Definition at line 578 of file ScopeInfo.h.

References CaptureMap, Captures, and isCaptured().

Referenced by clang::Sema::ActOnStartOfLambdaDefinition(), and isVariableAlreadyCapturedInScopeInfo().

const Capture& clang::sema::CapturingScopeInfo::getCapture ( VarDecl Var) const
inline

Definition at line 583 of file ScopeInfo.h.

References CaptureMap, and Captures.

Capture& clang::sema::CapturingScopeInfo::getCXXThisCapture ( )
inline

Retrieve the capture of C++ 'this', if it has been captured.

Definition at line 563 of file ScopeInfo.h.

References Captures, CXXThisCaptureIndex, and isCXXThisCaptured().

Referenced by clang::Sema::ActOnStartOfLambdaDefinition(), and adjustCVQualifiersForCXXThisWithinLambda().

bool clang::sema::CapturingScopeInfo::isCaptured ( VarDecl Var) const
inline

Determine whether the given variable has been captured.

Definition at line 569 of file ScopeInfo.h.

References CaptureMap.

Referenced by clang::Sema::ActOnStartOfLambdaDefinition(), getCapture(), and getStackIndexOfNearestEnclosingCaptureReadyLambda().

bool clang::sema::CapturingScopeInfo::isCXXThisCaptured ( ) const
inline
bool CapturingScopeInfo::isVLATypeCaptured ( const VariableArrayType VAT) const

Determine whether the given variable-array type has been captured.

Definition at line 106 of file ScopeInfo.cpp.

References clang::RecordDecl::fields().

Referenced by captureVariablyModifiedType().

Member Data Documentation

llvm::DenseMap<VarDecl*, unsigned> clang::sema::CapturingScopeInfo::CaptureMap

CaptureMap - A map of captured variables to (index+1) into Captures.

Definition at line 521 of file ScopeInfo.h.

Referenced by addCapture(), getCapture(), isCaptured(), and isVariableAlreadyCapturedInScopeInfo().

SmallVector<Capture, 4> clang::sema::CapturingScopeInfo::Captures
unsigned clang::sema::CapturingScopeInfo::CXXThisCaptureIndex

CXXThisCaptureIndex - The (index+1) of the capture of 'this'; zero if 'this' is not captured.

Definition at line 525 of file ScopeInfo.h.

Referenced by clang::Sema::ActOnBlockStmtExpr(), getCXXThisCapture(), and isCXXThisCaptured().

bool clang::sema::CapturingScopeInfo::HasImplicitReturnType

  • Whether the target type of return statements in this context is deduced (e.g.

a lambda or block with omitted return type).

Definition at line 532 of file ScopeInfo.h.

Referenced by clang::Sema::ActOnBlockStart(), clang::Sema::ActOnBlockStmtExpr(), clang::Sema::ActOnCapScopeReturnStmt(), clang::Sema::BuildLambdaExpr(), clang::Sema::buildLambdaScope(), clang::Sema::deduceClosureReturnType(), and clang::Sema::DeduceFunctionTypeFromReturnExpr().

ImplicitCaptureStyle clang::sema::CapturingScopeInfo::ImpCaptureStyle
QualType clang::sema::CapturingScopeInfo::ReturnType

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