clang 22.0.0git
clang::CXXForRangeStmt Class Reference

CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (range-declarator : range-expression)' or 'for (init-statement range-declarator : range-expression)'. More...

#include "clang/AST/StmtCXX.h"

Inheritance diagram for clang::CXXForRangeStmt:
[legend]

Public Member Functions

 CXXForRangeStmt (Stmt *InitStmt, DeclStmt *Range, DeclStmt *Begin, DeclStmt *End, Expr *Cond, Expr *Inc, DeclStmt *LoopVar, Stmt *Body, SourceLocation FL, SourceLocation CAL, SourceLocation CL, SourceLocation RPL)
 CXXForRangeStmt (EmptyShell Empty)
StmtgetInit ()
VarDeclgetLoopVariable ()
ExprgetRangeInit ()
const StmtgetInit () const
const VarDeclgetLoopVariable () const
const ExprgetRangeInit () const
DeclStmtgetRangeStmt ()
DeclStmtgetBeginStmt ()
DeclStmtgetEndStmt ()
ExprgetCond ()
ExprgetInc ()
DeclStmtgetLoopVarStmt ()
StmtgetBody ()
const DeclStmtgetRangeStmt () const
const DeclStmtgetBeginStmt () const
const DeclStmtgetEndStmt () const
const ExprgetCond () const
const ExprgetInc () const
const DeclStmtgetLoopVarStmt () const
const StmtgetBody () const
void setInit (Stmt *S)
void setRangeInit (Expr *E)
void setRangeStmt (Stmt *S)
void setBeginStmt (Stmt *S)
void setEndStmt (Stmt *S)
void setCond (Expr *E)
void setInc (Expr *E)
void setLoopVarStmt (Stmt *S)
void setBody (Stmt *S)
SourceLocation getForLoc () const
SourceLocation getCoawaitLoc () const
SourceLocation getColonLoc () const
SourceLocation getRParenLoc () const
SourceLocation getBeginLoc () const LLVM_READONLY
SourceLocation getEndLoc () 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.
SourceLocation getBeginLoc () const LLVM_READONLY
SourceLocation getEndLoc () const LLVM_READONLY
void dump () const
 Dumps the specified AST fragment and all subtrees to llvm::errs().
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.
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.
void printPretty (raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
void printPrettyControlled (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.
void viewAST () const
 viewAST - Visualize an AST rooted at this Stmt* using GraphViz.
StmtIgnoreContainers (bool IgnoreCaptured=false)
 Skip no-op (attributed, compound) container stmts and skip captured stmt at the top, if IgnoreCaptured is true.
const StmtIgnoreContainers (bool IgnoreCaptured=false) const
const StmtstripLabelLikeStatements () const
 Strip off all label-like statements.
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, bool ProfileLambdaExpr=false) const
 Produce a unique representation of the given statement.
void ProcessODRHash (llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
 Calculate a unique representation for a statement that is stable across compiler invocations.

Static Public Member Functions

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

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/subexpressions of an AST node.
using const_child_iterator = ConstStmtIterator
using child_range = llvm::iterator_range<child_iterator>
using const_child_range = llvm::iterator_range<const_child_iterator>
Protected Types inherited from clang::Stmt
enum  { NumExprBits = NumStmtBits + 5 + llvm::BitWidth<ExprDependence> }
enum  { NumCallExprBits = 25 }
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 *.
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.
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 
   LoopControlStmtBitfields   LoopControlStmtBits 
   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 
   ParenExprBitfields   ParenExprBits 
   ShuffleVectorExprBitfields   ShuffleVectorExprBits 
   StmtExprBitfields   StmtExprBits 
   ChooseExprBitfields   ChooseExprBits 
   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 
   ArrayTypeTraitExprBitfields   ArrayTypeTraitExprBits 
   ExpressionTraitExprBitfields   ExpressionTraitExprBits 
   CXXFoldExprBitfields   CXXFoldExprBits 
   PackIndexingExprBitfields   PackIndexingExprBits 
   CoawaitExprBitfields   CoawaitBits 
   ObjCIndirectCopyRestoreExprBitfields   ObjCIndirectCopyRestoreExprBits 
   OpaqueValueExprBitfields   OpaqueValueExprBits 
   ConvertVectorExprBitfields   ConvertVectorExprBits 
}; 

Detailed Description

CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (range-declarator : range-expression)' or 'for (init-statement range-declarator : range-expression)'.

This is stored in a partially-desugared form to allow full semantic analysis of the constituent components. The original syntactic components can be extracted using getLoopVariable and getRangeInit.

Definition at line 135 of file StmtCXX.h.

Constructor & Destructor Documentation

◆ CXXForRangeStmt() [1/2]

CXXForRangeStmt::CXXForRangeStmt ( Stmt * InitStmt,
DeclStmt * Range,
DeclStmt * Begin,
DeclStmt * End,
Expr * Cond,
Expr * Inc,
DeclStmt * LoopVar,
Stmt * Body,
SourceLocation FL,
SourceLocation CAL,
SourceLocation CL,
SourceLocation RPL )

Definition at line 48 of file StmtCXX.cpp.

References clang::Cond, clang::Init, and clang::Stmt::Stmt().

Referenced by getLoopVariable(), and getRangeInit().

◆ CXXForRangeStmt() [2/2]

clang::CXXForRangeStmt::CXXForRangeStmt ( EmptyShell Empty)
inline

Definition at line 151 of file StmtCXX.h.

References clang::Empty, and clang::Stmt::Stmt().

Member Function Documentation

◆ children() [1/2]

child_range clang::CXXForRangeStmt::children ( )
inline

Definition at line 217 of file StmtCXX.h.

◆ children() [2/2]

const_child_range clang::CXXForRangeStmt::children ( ) const
inline

Definition at line 221 of file StmtCXX.h.

◆ classof()

bool clang::CXXForRangeStmt::classof ( const Stmt * T)
inlinestatic

Definition at line 212 of file StmtCXX.h.

References clang::Stmt::Stmt(), and clang::T.

◆ getBeginLoc()

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

Definition at line 207 of file StmtCXX.h.

◆ getBeginStmt() [1/2]

◆ getBeginStmt() [2/2]

const DeclStmt * clang::CXXForRangeStmt::getBeginStmt ( ) const
inline

Definition at line 175 of file StmtCXX.h.

◆ getBody() [1/2]

◆ getBody() [2/2]

const Stmt * clang::CXXForRangeStmt::getBody ( ) const
inline

Definition at line 190 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ getCoawaitLoc()

SourceLocation clang::CXXForRangeStmt::getCoawaitLoc ( ) const
inline

Definition at line 203 of file StmtCXX.h.

Referenced by clang::ASTNodeImporter::VisitCXXForRangeStmt().

◆ getColonLoc()

SourceLocation clang::CXXForRangeStmt::getColonLoc ( ) const
inline

Definition at line 204 of file StmtCXX.h.

Referenced by clang::ASTNodeImporter::VisitCXXForRangeStmt().

◆ getCond() [1/2]

◆ getCond() [2/2]

const Expr * clang::CXXForRangeStmt::getCond ( ) const
inline

Definition at line 181 of file StmtCXX.h.

◆ getEndLoc()

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

Definition at line 208 of file StmtCXX.h.

◆ getEndStmt() [1/2]

◆ getEndStmt() [2/2]

const DeclStmt * clang::CXXForRangeStmt::getEndStmt ( ) const
inline

Definition at line 178 of file StmtCXX.h.

◆ getForLoc()

SourceLocation clang::CXXForRangeStmt::getForLoc ( ) const
inline

◆ getInc() [1/2]

◆ getInc() [2/2]

const Expr * clang::CXXForRangeStmt::getInc ( ) const
inline

Definition at line 184 of file StmtCXX.h.

◆ getInit() [1/2]

◆ getInit() [2/2]

const Stmt * clang::CXXForRangeStmt::getInit ( ) const
inline

Definition at line 157 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ getLoopVariable() [1/2]

VarDecl * CXXForRangeStmt::getLoopVariable ( )

◆ getLoopVariable() [2/2]

const VarDecl * CXXForRangeStmt::getLoopVariable ( ) const

Definition at line 83 of file StmtCXX.cpp.

References CXXForRangeStmt(), and getLoopVariable().

◆ getLoopVarStmt() [1/2]

◆ getLoopVarStmt() [2/2]

const DeclStmt * clang::CXXForRangeStmt::getLoopVarStmt ( ) const
inline

Definition at line 187 of file StmtCXX.h.

References clang::cast().

◆ getRangeInit() [1/2]

◆ getRangeInit() [2/2]

const Expr * CXXForRangeStmt::getRangeInit ( ) const

Definition at line 73 of file StmtCXX.cpp.

References CXXForRangeStmt(), and getRangeInit().

◆ getRangeStmt() [1/2]

◆ getRangeStmt() [2/2]

const DeclStmt * clang::CXXForRangeStmt::getRangeStmt ( ) const
inline

Definition at line 172 of file StmtCXX.h.

References clang::cast().

◆ getRParenLoc()

SourceLocation clang::CXXForRangeStmt::getRParenLoc ( ) const
inline

Definition at line 205 of file StmtCXX.h.

Referenced by clang::ASTNodeImporter::VisitCXXForRangeStmt().

◆ setBeginStmt()

void clang::CXXForRangeStmt::setBeginStmt ( Stmt * S)
inline

Definition at line 195 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setBody()

void clang::CXXForRangeStmt::setBody ( Stmt * S)
inline

Definition at line 200 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setCond()

void clang::CXXForRangeStmt::setCond ( Expr * E)
inline

Definition at line 197 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setEndStmt()

void clang::CXXForRangeStmt::setEndStmt ( Stmt * S)
inline

Definition at line 196 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setInc()

void clang::CXXForRangeStmt::setInc ( Expr * E)
inline

Definition at line 198 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setInit()

void clang::CXXForRangeStmt::setInit ( Stmt * S)
inline

Definition at line 192 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setLoopVarStmt()

void clang::CXXForRangeStmt::setLoopVarStmt ( Stmt * S)
inline

Definition at line 199 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setRangeInit()

void clang::CXXForRangeStmt::setRangeInit ( Expr * E)
inline

Definition at line 193 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ setRangeStmt()

void clang::CXXForRangeStmt::setRangeStmt ( Stmt * S)
inline

Definition at line 194 of file StmtCXX.h.

References clang::Stmt::Stmt().

◆ ASTStmtReader

friend class ASTStmtReader
friend

Definition at line 145 of file StmtCXX.h.

References ASTStmtReader, clang::Cond, and clang::Stmt::Stmt().

Referenced by ASTStmtReader.


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