clang  9.0.0svn
Public Member Functions | Static Public Member Functions | Friends | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for clang::CXXForRangeStmt:
Collaboration graph
[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 (StmtClass SC)
 
StmtClass getStmtClass () const
 
 Stmt (const Stmt &)=delete
 
 Stmt (Stmt &&)=delete
 
Stmtoperator= (const Stmt &)=delete
 
Stmtoperator= (Stmt &&)=delete
 
const char * getStmtClassName () const
 
bool isOMPStructuredBlock () const
 
void setIsOMPStructuredBlock (bool IsOMPStructuredBlock)
 
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 (SourceManager &SM) const
 
void dump (raw_ostream &OS, SourceManager &SM) const
 
void dump (raw_ostream &OS) 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="\, const ASTContext *Context=nullptr) const
 
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 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 ()
 

Friends

class ASTStmtReader
 

Additional Inherited Members

- Public Types inherited from clang::Stmt
enum  StmtClass { NoStmtClass = 0 }
 
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 >
 
- Protected Types inherited from clang::Stmt
enum  { NumStmtBits = 9 }
 
enum  { NumExprBits = NumStmtBits + 9 }
 
enum  APFloatSemantics {
  IEEEhalf, IEEEsingle, IEEEdouble, x87DoubleExtended,
  IEEEquad, PPCDoubleDouble
}
 
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
 
   PredefinedExprBitfields   PredefinedExprBits
 
   DeclRefExprBitfields   DeclRefExprBits
 
   FloatingLiteralBitfields   FloatingLiteralBits
 
   StringLiteralBitfields   StringLiteralBits
 
   CharacterLiteralBitfields   CharacterLiteralBits
 
   UnaryOperatorBitfields   UnaryOperatorBits
 
   UnaryExprOrTypeTraitExprBitfields   UnaryExprOrTypeTraitExprBits
 
   ArraySubscriptExprBitfields   ArraySubscriptExprBits
 
   CallExprBitfields   CallExprBits
 
   MemberExprBitfields   MemberExprBits
 
   CastExprBitfields   CastExprBits
 
   BinaryOperatorBitfields   BinaryOperatorBits
 
   InitListExprBitfields   InitListExprBits
 
   ParenListExprBitfields   ParenListExprBits
 
   GenericSelectionExprBitfields   GenericSelectionExprBits
 
   PseudoObjectExprBitfields   PseudoObjectExprBits
 
   CXXOperatorCallExprBitfields   CXXOperatorCallExprBits
 
   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
 
   CoawaitExprBitfields   CoawaitBits
 
   ObjCIndirectCopyRestoreExprBitfields   ObjCIndirectCopyRestoreExprBits
 
   OpaqueValueExprBitfields   OpaqueValueExprBits
 
}; 
 

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 134 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 47 of file StmtCXX.cpp.

◆ CXXForRangeStmt() [2/2]

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

Definition at line 150 of file StmtCXX.h.

Member Function Documentation

◆ children() [1/2]

child_range clang::CXXForRangeStmt::children ( )
inline

Definition at line 216 of file StmtCXX.h.

◆ children() [2/2]

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

Definition at line 220 of file StmtCXX.h.

◆ classof()

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

Definition at line 211 of file StmtCXX.h.

References clang::Stmt::getStmtClass().

◆ getBeginLoc()

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

Definition at line 206 of file StmtCXX.h.

Referenced by DiagnoseForRangeVariableCopies().

◆ getBeginStmt() [1/2]

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

Definition at line 162 of file StmtCXX.h.

◆ getBeginStmt() [2/2]

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

Definition at line 174 of file StmtCXX.h.

◆ getBody() [1/2]

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

Definition at line 169 of file StmtCXX.h.

◆ getBody() [2/2]

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

Definition at line 189 of file StmtCXX.h.

◆ getCoawaitLoc()

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

Definition at line 202 of file StmtCXX.h.

◆ getColonLoc()

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

Definition at line 203 of file StmtCXX.h.

References ColonLoc.

◆ getCond() [1/2]

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

Definition at line 166 of file StmtCXX.h.

◆ getCond() [2/2]

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

Definition at line 180 of file StmtCXX.h.

◆ getEndLoc()

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

Definition at line 207 of file StmtCXX.h.

References clang::Stmt::getEndLoc().

◆ getEndStmt() [1/2]

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

Definition at line 165 of file StmtCXX.h.

◆ getEndStmt() [2/2]

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

Definition at line 177 of file StmtCXX.h.

◆ getForLoc()

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

Definition at line 201 of file StmtCXX.h.

◆ getInc() [1/2]

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

Definition at line 167 of file StmtCXX.h.

◆ getInc() [2/2]

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

Definition at line 183 of file StmtCXX.h.

◆ getInit() [1/2]

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

Definition at line 152 of file StmtCXX.h.

◆ getInit() [2/2]

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

Definition at line 156 of file StmtCXX.h.

◆ getLoopVariable() [1/2]

VarDecl * CXXForRangeStmt::getLoopVariable ( )

Definition at line 76 of file StmtCXX.cpp.

References getLoopVarStmt().

Referenced by DiagnoseForRangeVariableCopies(), and getLoopVariable().

◆ getLoopVariable() [2/2]

const VarDecl * CXXForRangeStmt::getLoopVariable ( ) const

Definition at line 82 of file StmtCXX.cpp.

References getLoopVariable().

◆ getLoopVarStmt() [1/2]

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

Definition at line 168 of file StmtCXX.h.

Referenced by getLoopVariable().

◆ getLoopVarStmt() [2/2]

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

Definition at line 186 of file StmtCXX.h.

◆ getRangeInit() [1/2]

Expr * CXXForRangeStmt::getRangeInit ( )

◆ getRangeInit() [2/2]

const Expr * CXXForRangeStmt::getRangeInit ( ) const

Definition at line 72 of file StmtCXX.cpp.

References getRangeInit().

◆ getRangeStmt() [1/2]

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

Definition at line 161 of file StmtCXX.h.

References RANGE.

Referenced by getRangeInit().

◆ getRangeStmt() [2/2]

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

Definition at line 171 of file StmtCXX.h.

References RANGE.

◆ getRParenLoc()

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

Definition at line 204 of file StmtCXX.h.

◆ setBeginStmt()

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

Definition at line 194 of file StmtCXX.h.

◆ setBody()

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

Definition at line 199 of file StmtCXX.h.

◆ setCond()

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

Definition at line 196 of file StmtCXX.h.

◆ setEndStmt()

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

Definition at line 195 of file StmtCXX.h.

◆ setInc()

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

Definition at line 197 of file StmtCXX.h.

◆ setInit()

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

Definition at line 191 of file StmtCXX.h.

◆ setLoopVarStmt()

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

Definition at line 198 of file StmtCXX.h.

◆ setRangeInit()

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

Definition at line 192 of file StmtCXX.h.

References RANGE.

◆ setRangeStmt()

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

Definition at line 193 of file StmtCXX.h.

Friends And Related Function Documentation

◆ ASTStmtReader

friend class ASTStmtReader
friend

Definition at line 144 of file StmtCXX.h.


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