clang  14.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::CapturedStmt Class Reference

This captures a statement into a function. More...

#include "clang/AST/Stmt.h"

Inheritance diagram for clang::CapturedStmt:
Inheritance graph
[legend]
Collaboration diagram for clang::CapturedStmt:
Collaboration graph
[legend]

Classes

class  Capture
 Describes the capture of either a variable, or 'this', or variable-length array type. More...
 

Public Types

enum  VariableCaptureKind { VCK_This, VCK_ByRef, VCK_ByCopy, VCK_VLAType }
 The different capture forms: by 'this', by reference, capture for variable-length array type etc. More...
 
using capture_iterator = Capture *
 An iterator that walks over the captures. More...
 
using const_capture_iterator = const Capture *
 
using capture_range = llvm::iterator_range< capture_iterator >
 
using capture_const_range = llvm::iterator_range< const_capture_iterator >
 
using capture_init_iterator = Expr **
 Iterator that walks over the capture initialization arguments. More...
 
using capture_init_range = llvm::iterator_range< capture_init_iterator >
 
using const_capture_init_iterator = Expr *const *
 Const iterator that walks over the capture initialization arguments. More...
 
using const_capture_init_range = llvm::iterator_range< const_capture_init_iterator >
 
- Public Types inherited from clang::Stmt
enum  StmtClass { NoStmtClass = 0 }
 
enum  Likelihood { LH_Unlikely = -1, LH_None, LH_Likely }
 The likelihood of a branch being taken. More...
 
using child_iterator = StmtIterator
 Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatements/subexpessions of an AST node. More...
 
using const_child_iterator = ConstStmtIterator
 
using child_range = llvm::iterator_range< child_iterator >
 
using const_child_range = llvm::iterator_range< const_child_iterator >
 

Public Member Functions

StmtgetCapturedStmt ()
 Retrieve the statement being captured. More...
 
const StmtgetCapturedStmt () const
 
CapturedDeclgetCapturedDecl ()
 Retrieve the outlined function declaration. More...
 
const CapturedDeclgetCapturedDecl () const
 
void setCapturedDecl (CapturedDecl *D)
 Set the outlined function declaration. More...
 
CapturedRegionKind getCapturedRegionKind () const
 Retrieve the captured region kind. More...
 
void setCapturedRegionKind (CapturedRegionKind Kind)
 Set the captured region kind. More...
 
const RecordDeclgetCapturedRecordDecl () const
 Retrieve the record declaration for captured variables. More...
 
void setCapturedRecordDecl (RecordDecl *D)
 Set the record declaration for captured variables. More...
 
bool capturesVariable (const VarDecl *Var) const
 True if this variable has been captured. More...
 
capture_range captures ()
 
capture_const_range captures () const
 
capture_iterator capture_begin ()
 Retrieve an iterator pointing to the first capture. More...
 
const_capture_iterator capture_begin () const
 
capture_iterator capture_end () const
 Retrieve an iterator pointing past the end of the sequence of captures. More...
 
unsigned capture_size () const
 Retrieve the number of captures, including 'this'. More...
 
capture_init_range capture_inits ()
 
const_capture_init_range capture_inits () const
 
capture_init_iterator capture_init_begin ()
 Retrieve the first initialization argument. More...
 
const_capture_init_iterator capture_init_begin () const
 
capture_init_iterator capture_init_end ()
 Retrieve the iterator pointing one past the last initialization argument. More...
 
const_capture_init_iterator capture_init_end () const
 
SourceLocation getBeginLoc () const LLVM_READONLY
 
SourceLocation getEndLoc () const LLVM_READONLY
 
SourceRange getSourceRange () const LLVM_READONLY
 
child_range children ()
 
const_child_range children () const
 
- Public Member Functions inherited from clang::Stmt
void * operator new (size_t bytes, const ASTContext &C, unsigned alignment=8)
 
void * operator new (size_t bytes, const ASTContext *C, unsigned alignment=8)
 
void * operator new (size_t bytes, void *mem) noexcept
 
void operator delete (void *, const ASTContext &, unsigned) noexcept
 
void operator delete (void *, const ASTContext *, unsigned) noexcept
 
void operator delete (void *, size_t) noexcept
 
void operator delete (void *, void *) noexcept
 
 Stmt ()=delete
 
 Stmt (const Stmt &)=delete
 
 Stmt (Stmt &&)=delete
 
Stmtoperator= (const Stmt &)=delete
 
Stmtoperator= (Stmt &&)=delete
 
 Stmt (StmtClass SC)
 
StmtClass getStmtClass () const
 
const char * getStmtClassName () const
 
SourceRange getSourceRange () const LLVM_READONLY
 SourceLocation tokens are not useful in isolation - they are low level value objects created/interpreted by SourceManager. More...
 
SourceLocation getBeginLoc () const LLVM_READONLY
 
SourceLocation getEndLoc () const LLVM_READONLY
 
void dump () const
 Dumps the specified AST fragment and all subtrees to llvm::errs(). More...
 
void dump (raw_ostream &OS, const ASTContext &Context) const
 
int64_t getID (const ASTContext &Context) const
 
void dumpColor () const
 dumpColor - same as dump(), but forces color highlighting. More...
 
void dumpPretty (const ASTContext &Context) const
 dumpPretty/printPretty - These two methods do a "pretty print" of the AST back to its original source language syntax. More...
 
void printPretty (raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
 
void printJson (raw_ostream &Out, PrinterHelper *Helper, const PrintingPolicy &Policy, bool AddQuotes) const
 Pretty-prints in JSON format. More...
 
void viewAST () const
 viewAST - Visualize an AST rooted at this Stmt* using GraphViz. More...
 
StmtIgnoreContainers (bool IgnoreCaptured=false)
 Skip no-op (attributed, compound) container stmts and skip captured stmt at the top, if IgnoreCaptured is true. More...
 
const StmtIgnoreContainers (bool IgnoreCaptured=false) const
 
const StmtstripLabelLikeStatements () const
 Strip off all label-like statements. More...
 
StmtstripLabelLikeStatements ()
 
child_range children ()
 
const_child_range children () const
 
child_iterator child_begin ()
 
child_iterator child_end ()
 
const_child_iterator child_begin () const
 
const_child_iterator child_end () const
 
void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
 Produce a unique representation of the given statement. More...
 
void ProcessODRHash (llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
 Calculate a unique representation for a statement that is stable across compiler invocations. More...
 

Static Public Member Functions

static CapturedStmtCreate (const ASTContext &Context, Stmt *S, CapturedRegionKind Kind, ArrayRef< Capture > Captures, ArrayRef< Expr * > CaptureInits, CapturedDecl *CD, RecordDecl *RD)
 
static CapturedStmtCreateDeserialized (const ASTContext &Context, unsigned NumCaptures)
 
static bool classof (const Stmt *T)
 
- Static Public Member Functions inherited from clang::Stmt
static void addStmtClass (const StmtClass s)
 
static void EnableStatistics ()
 
static void PrintStats ()
 
static Likelihood getLikelihood (ArrayRef< const Attr * > Attrs)
 
static Likelihood getLikelihood (const Stmt *S)
 
static const AttrgetLikelihoodAttr (const Stmt *S)
 
static Likelihood getLikelihood (const Stmt *Then, const Stmt *Else)
 
static std::tuple< bool, const Attr *, const Attr * > determineLikelihoodConflict (const Stmt *Then, const Stmt *Else)
 

Friends

class ASTStmtReader
 

Additional Inherited Members

- Protected Types inherited from clang::Stmt
enum  { NumStmtBits = 8 }
 
enum  { NumExprBits = NumStmtBits + 5 + llvm::BitWidth<ExprDependence> }
 
enum  { NumCallExprBits = 32 }
 
enum  { NumOverloadExprBits = NumExprBits + 1 }
 
template<typename T >
using ConstCastIterator = CastIterator< T, const T *const, const Stmt *const >
 Const iterator for iterating over Stmt * arrays that contain only T *. More...
 
using ExprIterator = CastIterator< Expr >
 
using ConstExprIterator = ConstCastIterator< Expr >
 
- Protected Member Functions inherited from clang::Stmt
void * operator new (size_t bytes) noexcept
 
void operator delete (void *data) noexcept
 
 Stmt (StmtClass SC, EmptyShell)
 Construct an empty statement. More...
 
- Protected Attributes inherited from clang::Stmt
union {
   StmtBitfields   StmtBits
 
   NullStmtBitfields   NullStmtBits
 
   CompoundStmtBitfields   CompoundStmtBits
 
   LabelStmtBitfields   LabelStmtBits
 
   AttributedStmtBitfields   AttributedStmtBits
 
   IfStmtBitfields   IfStmtBits
 
   SwitchStmtBitfields   SwitchStmtBits
 
   WhileStmtBitfields   WhileStmtBits
 
   DoStmtBitfields   DoStmtBits
 
   ForStmtBitfields   ForStmtBits
 
   GotoStmtBitfields   GotoStmtBits
 
   ContinueStmtBitfields   ContinueStmtBits
 
   BreakStmtBitfields   BreakStmtBits
 
   ReturnStmtBitfields   ReturnStmtBits
 
   SwitchCaseBitfields   SwitchCaseBits
 
   ExprBitfields   ExprBits
 
   ConstantExprBitfields   ConstantExprBits
 
   PredefinedExprBitfields   PredefinedExprBits
 
   DeclRefExprBitfields   DeclRefExprBits
 
   FloatingLiteralBitfields   FloatingLiteralBits
 
   StringLiteralBitfields   StringLiteralBits
 
   CharacterLiteralBitfields   CharacterLiteralBits
 
   UnaryOperatorBitfields   UnaryOperatorBits
 
   UnaryExprOrTypeTraitExprBitfields   UnaryExprOrTypeTraitExprBits
 
   ArrayOrMatrixSubscriptExprBitfields   ArrayOrMatrixSubscriptExprBits
 
   CallExprBitfields   CallExprBits
 
   MemberExprBitfields   MemberExprBits
 
   CastExprBitfields   CastExprBits
 
   BinaryOperatorBitfields   BinaryOperatorBits
 
   InitListExprBitfields   InitListExprBits
 
   ParenListExprBitfields   ParenListExprBits
 
   GenericSelectionExprBitfields   GenericSelectionExprBits
 
   PseudoObjectExprBitfields   PseudoObjectExprBits
 
   SourceLocExprBitfields   SourceLocExprBits
 
   StmtExprBitfields   StmtExprBits
 
   CXXOperatorCallExprBitfields   CXXOperatorCallExprBits
 
   CXXRewrittenBinaryOperatorBitfields   CXXRewrittenBinaryOperatorBits
 
   CXXBoolLiteralExprBitfields   CXXBoolLiteralExprBits
 
   CXXNullPtrLiteralExprBitfields   CXXNullPtrLiteralExprBits
 
   CXXThisExprBitfields   CXXThisExprBits
 
   CXXThrowExprBitfields   CXXThrowExprBits
 
   CXXDefaultArgExprBitfields   CXXDefaultArgExprBits
 
   CXXDefaultInitExprBitfields   CXXDefaultInitExprBits
 
   CXXScalarValueInitExprBitfields   CXXScalarValueInitExprBits
 
   CXXNewExprBitfields   CXXNewExprBits
 
   CXXDeleteExprBitfields   CXXDeleteExprBits
 
   TypeTraitExprBitfields   TypeTraitExprBits
 
   DependentScopeDeclRefExprBitfields   DependentScopeDeclRefExprBits
 
   CXXConstructExprBitfields   CXXConstructExprBits
 
   ExprWithCleanupsBitfields   ExprWithCleanupsBits
 
   CXXUnresolvedConstructExprBitfields   CXXUnresolvedConstructExprBits
 
   CXXDependentScopeMemberExprBitfields   CXXDependentScopeMemberExprBits
 
   OverloadExprBitfields   OverloadExprBits
 
   UnresolvedLookupExprBitfields   UnresolvedLookupExprBits
 
   UnresolvedMemberExprBitfields   UnresolvedMemberExprBits
 
   CXXNoexceptExprBitfields   CXXNoexceptExprBits
 
   SubstNonTypeTemplateParmExprBitfields   SubstNonTypeTemplateParmExprBits
 
   LambdaExprBitfields   LambdaExprBits
 
   RequiresExprBitfields   RequiresExprBits
 
   CoawaitExprBitfields   CoawaitBits
 
   ObjCIndirectCopyRestoreExprBitfields   ObjCIndirectCopyRestoreExprBits
 
   OpaqueValueExprBitfields   OpaqueValueExprBits
 
}; 
 

Detailed Description

This captures a statement into a function.

For example, the following pragma annotated compound statement can be represented as a CapturedStmt, and this compound statement is the body of an anonymous outlined function.

#pragma omp parallel
{
compute();
}

Definition at line 3500 of file Stmt.h.

Member Typedef Documentation

◆ capture_const_range

Definition at line 3633 of file Stmt.h.

◆ capture_init_iterator

Iterator that walks over the capture initialization arguments.

Definition at line 3656 of file Stmt.h.

◆ capture_init_range

Definition at line 3657 of file Stmt.h.

◆ capture_iterator

An iterator that walks over the captures.

Definition at line 3630 of file Stmt.h.

◆ capture_range

Definition at line 3632 of file Stmt.h.

◆ const_capture_init_iterator

Const iterator that walks over the capture initialization arguments.

Definition at line 3661 of file Stmt.h.

◆ const_capture_init_range

Definition at line 3663 of file Stmt.h.

◆ const_capture_iterator

Definition at line 3631 of file Stmt.h.

Member Enumeration Documentation

◆ VariableCaptureKind

The different capture forms: by 'this', by reference, capture for variable-length array type etc.

Enumerator
VCK_This 
VCK_ByRef 
VCK_ByCopy 
VCK_VLAType 

Definition at line 3504 of file Stmt.h.

Member Function Documentation

◆ capture_begin() [1/2]

capture_iterator clang::CapturedStmt::capture_begin ( )
inline

Retrieve an iterator pointing to the first capture.

Definition at line 3643 of file Stmt.h.

Referenced by captures().

◆ capture_begin() [2/2]

const_capture_iterator clang::CapturedStmt::capture_begin ( ) const
inline

Definition at line 3644 of file Stmt.h.

◆ capture_end()

capture_iterator clang::CapturedStmt::capture_end ( ) const
inline

Retrieve an iterator pointing past the end of the sequence of captures.

Definition at line 3648 of file Stmt.h.

Referenced by captures().

◆ capture_init_begin() [1/2]

capture_init_iterator clang::CapturedStmt::capture_init_begin ( )
inline

Retrieve the first initialization argument.

Definition at line 3674 of file Stmt.h.

Referenced by capture_init_end(), and capture_inits().

◆ capture_init_begin() [2/2]

const_capture_init_iterator clang::CapturedStmt::capture_init_begin ( ) const
inline

Definition at line 3678 of file Stmt.h.

◆ capture_init_end() [1/2]

capture_init_iterator clang::CapturedStmt::capture_init_end ( )
inline

Retrieve the iterator pointing one past the last initialization argument.

Definition at line 3684 of file Stmt.h.

References capture_init_begin().

Referenced by capture_inits().

◆ capture_init_end() [2/2]

const_capture_init_iterator clang::CapturedStmt::capture_init_end ( ) const
inline

Definition at line 3688 of file Stmt.h.

References capture_init_begin().

◆ capture_inits() [1/2]

capture_init_range clang::CapturedStmt::capture_inits ( )
inline

Definition at line 3665 of file Stmt.h.

References capture_init_begin(), and capture_init_end().

◆ capture_inits() [2/2]

const_capture_init_range clang::CapturedStmt::capture_inits ( ) const
inline

Definition at line 3669 of file Stmt.h.

References capture_init_begin(), and capture_init_end().

◆ capture_size()

unsigned clang::CapturedStmt::capture_size ( ) const
inline

Retrieve the number of captures, including 'this'.

Definition at line 3653 of file Stmt.h.

◆ captures() [1/2]

capture_range clang::CapturedStmt::captures ( )
inline

◆ captures() [2/2]

capture_const_range clang::CapturedStmt::captures ( ) const
inline

Definition at line 3638 of file Stmt.h.

References capture_begin(), and capture_end().

◆ capturesVariable()

bool CapturedStmt::capturesVariable ( const VarDecl Var) const

◆ children() [1/2]

Stmt::const_child_range CapturedStmt::children ( )

Definition at line 1384 of file Stmt.cpp.

◆ children() [2/2]

const_child_range clang::CapturedStmt::children ( ) const

◆ classof()

static bool clang::CapturedStmt::classof ( const Stmt T)
inlinestatic

Definition at line 3704 of file Stmt.h.

References clang::Stmt::getStmtClass().

◆ Create()

CapturedStmt * CapturedStmt::Create ( const ASTContext Context,
Stmt S,
CapturedRegionKind  Kind,
ArrayRef< Capture Captures,
ArrayRef< Expr * >  CaptureInits,
CapturedDecl CD,
RecordDecl RD 
)
static

Definition at line 1343 of file Stmt.cpp.

◆ CreateDeserialized()

CapturedStmt * CapturedStmt::CreateDeserialized ( const ASTContext Context,
unsigned  NumCaptures 
)
static

Definition at line 1371 of file Stmt.cpp.

References clang::ASTContext::Allocate().

◆ getBeginLoc()

SourceLocation clang::CapturedStmt::getBeginLoc ( ) const
inline

Definition at line 3692 of file Stmt.h.

References clang::Stmt::getBeginLoc(), and getCapturedStmt().

◆ getCapturedDecl() [1/2]

const CapturedDecl * CapturedStmt::getCapturedDecl ( )

Retrieve the outlined function declaration.

Definition at line 1393 of file Stmt.cpp.

Referenced by clang::Sema::ActOnOpenMPDistributeParallelForDirective(), clang::Sema::ActOnOpenMPDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPDistributeSimdDirective(), clang::Sema::ActOnOpenMPParallelDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), clang::Sema::ActOnOpenMPParallelMasterDirective(), clang::Sema::ActOnOpenMPParallelMasterTaskLoopDirective(), clang::Sema::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::Sema::ActOnOpenMPTargetDirective(), clang::Sema::ActOnOpenMPTargetEnterDataDirective(), clang::Sema::ActOnOpenMPTargetExitDataDirective(), clang::Sema::ActOnOpenMPTargetParallelDirective(), clang::Sema::ActOnOpenMPTargetParallelForDirective(), clang::Sema::ActOnOpenMPTargetParallelForSimdDirective(), clang::Sema::ActOnOpenMPTargetSimdDirective(), clang::Sema::ActOnOpenMPTargetTeamsDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::Sema::ActOnOpenMPTargetUpdateDirective(), clang::Sema::ActOnOpenMPTaskDirective(), clang::Sema::ActOnOpenMPTeamsDirective(), clang::Sema::ActOnOpenMPTeamsDistributeDirective(), clang::Sema::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::Sema::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPTeamsDistributeSimdDirective(), and clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction().

◆ getCapturedDecl() [2/2]

const CapturedDecl* clang::CapturedStmt::getCapturedDecl ( ) const

◆ getCapturedRecordDecl()

const RecordDecl* clang::CapturedStmt::getCapturedRecordDecl ( ) const
inline

Retrieve the record declaration for captured variables.

Definition at line 3618 of file Stmt.h.

◆ getCapturedRegionKind()

CapturedRegionKind CapturedStmt::getCapturedRegionKind ( ) const

Retrieve the captured region kind.

Definition at line 1408 of file Stmt.cpp.

◆ getCapturedStmt() [1/2]

Stmt* clang::CapturedStmt::getCapturedStmt ( )
inline

Retrieve the statement being captured.

Definition at line 3601 of file Stmt.h.

Referenced by clang::Sema::ActOnOpenMPDistributeParallelForDirective(), clang::Sema::ActOnOpenMPDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPDistributeSimdDirective(), clang::Sema::ActOnOpenMPParallelMasterTaskLoopDirective(), clang::Sema::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::Sema::ActOnOpenMPParallelSectionsDirective(), clang::Sema::ActOnOpenMPSectionsDirective(), clang::Sema::ActOnOpenMPTargetDirective(), clang::Sema::ActOnOpenMPTargetEnterDataDirective(), clang::Sema::ActOnOpenMPTargetExitDataDirective(), clang::Sema::ActOnOpenMPTargetParallelDirective(), clang::Sema::ActOnOpenMPTargetParallelForDirective(), clang::Sema::ActOnOpenMPTargetParallelForSimdDirective(), clang::Sema::ActOnOpenMPTargetSimdDirective(), clang::Sema::ActOnOpenMPTargetTeamsDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::Sema::ActOnOpenMPTargetUpdateDirective(), clang::Sema::ActOnOpenMPTeamsDistributeDirective(), clang::Sema::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::Sema::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPTeamsDistributeSimdDirective(), clang::CodeGen::CGOpenMPRuntime::emitNumThreadsForTargetDirective(), clang::CodeGen::CodeGenFunction::EmitOMPLoopBody(), clang::CodeGen::CodeGenFunction::EmitSimpleOMPExecutableDirective(), getBeginLoc(), getEndLoc(), getNestedDistributeDirective(), clang::CodeGen::CGOpenMPRuntime::getNumTeamsExprForTargetDirective(), getNumThreads(), getSourceRange(), hasNestedLightweightDirective(), and hasNestedSPMDDirective().

◆ getCapturedStmt() [2/2]

const Stmt* clang::CapturedStmt::getCapturedStmt ( ) const
inline

Definition at line 3602 of file Stmt.h.

◆ getEndLoc()

SourceLocation clang::CapturedStmt::getEndLoc ( ) const
inline

Definition at line 3696 of file Stmt.h.

References getCapturedStmt(), and clang::Stmt::getEndLoc().

◆ getSourceRange()

SourceRange clang::CapturedStmt::getSourceRange ( ) const
inline

Definition at line 3700 of file Stmt.h.

References getCapturedStmt(), and clang::Stmt::getSourceRange().

◆ setCapturedDecl()

void CapturedStmt::setCapturedDecl ( CapturedDecl D)

Set the outlined function declaration.

Definition at line 1402 of file Stmt.cpp.

◆ setCapturedRecordDecl()

void clang::CapturedStmt::setCapturedRecordDecl ( RecordDecl D)
inline

Set the record declaration for captured variables.

Definition at line 3621 of file Stmt.h.

◆ setCapturedRegionKind()

void CapturedStmt::setCapturedRegionKind ( CapturedRegionKind  Kind)

Set the captured region kind.

Definition at line 1413 of file Stmt.cpp.

Friends And Related Function Documentation

◆ ASTStmtReader

friend class ASTStmtReader
friend

Definition at line 3589 of file Stmt.h.


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