Home | History | Annotate | Download | only in AST

Lines Matching refs:Stmt

1 //===--- Stmt.cpp - Statement AST Node Implementation ---------------------===//
10 // This file implements the Stmt class and statement subclasses.
14 #include "clang/AST/Stmt.h"
30 } StmtClassInfo[Stmt::lastStmtConstant+1];
32 static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
39 #define ABSTRACT_STMT(STMT)
40 #define STMT(CLASS, PARENT) \
41 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Name = #CLASS; \
42 StmtClassInfo[(unsigned)Stmt::CLASS##Class].Size = sizeof(CLASS);
48 const char *Stmt::getStmtClassName() const {
52 void Stmt::PrintStats() {
54 getStmtInfoTableEntry(Stmt::NullStmtClass);
57 llvm::errs() << "\n*** Stmt/Expr Stats:\n";
58 for (int i = 0; i != Stmt::lastStmtConstant+1; i++) {
64 for (int i = 0; i != Stmt::lastStmtConstant+1; i++) {
77 void Stmt::addStmtClass(StmtClass s) {
81 bool Stmt::StatisticsEnabled = false;
82 void Stmt::EnableStatistics() {
86 Stmt *Stmt::IgnoreImplicit() {
87 Stmt *s = this;
102 const Stmt *Stmt::stripLabelLikeStatements() const {
103 const Stmt *S = this;
125 typedef Stmt::child_range children_t();
129 static inline bad implements_children(children_t Stmt::*) {
137 static inline bad implements_getSourceRange(getSourceRange_t Stmt::*) {
147 /// Check whether the various Stmt classes implement their member
151 #define STMT(type, base) \
157 Stmt::child_range Stmt::children() {
159 case Stmt::NoStmtClass: llvm_unreachable("statement without class");
161 #define STMT(type, base) \
162 case Stmt::type##Class: \
169 SourceRange Stmt::getSourceRange() const {
171 case Stmt::NoStmtClass: llvm_unreachable("statement without class");
173 #define STMT(type, base) \
174 case Stmt::type##Class: \
189 SourceLocation getLocStartImpl(const Stmt *stmt,
191 return static_cast<const S*>(stmt)->getLocStart();
199 SourceLocation getLocStartImpl(const Stmt *stmt,
200 SourceLocation (Stmt::*v)() const) {
201 return static_cast<const S*>(stmt)->getSourceRange().getBegin();
207 SourceLocation getLocEndImpl(const Stmt *stmt,
209 return static_cast<const S*>(stmt)->getLocEnd();
217 SourceLocation getLocEndImpl(const Stmt *stmt,
218 SourceLocation (Stmt::*v)() const) {
219 return static_cast<const S*>(stmt)->getSourceRange().getEnd();
223 SourceLocation Stmt::getLocStart() const {
225 case Stmt::NoStmtClass: llvm_unreachable("statement without class");
227 #define STMT(type, base) \
228 case Stmt::type##Class: \
235 SourceLocation Stmt::getLocEnd() const {
237 case Stmt::NoStmtClass: llvm_unreachable("statement without class");
239 #define STMT(type, base) \
240 case Stmt::type##Class: \
247 void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) {
252 Body = new (C) Stmt*[NumStmts];
253 memcpy(Body, Stmts, sizeof(Stmt *) * NumStmts);
260 // This is defined here to avoid polluting Stmt.h with importing Expr.h
268 bool Stmt::hasImplicitControlFlow() const {
280 case Stmt::BinaryOperatorClass: {
329 Stmt **Exprs,
345 this->Exprs = new (C) Stmt*[NumExprs];
534 : Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr)
543 Exprs = new (C) Stmt*[NumExprs];
553 ObjCForCollectionStmt::ObjCForCollectionStmt(Stmt *Elem, Expr *Collect,
554 Stmt *Body, SourceLocation FCL,
556 : Stmt(ObjCForCollectionStmtClass) {
558 SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(Collect);
564 ObjCAtTryStmt::ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
565 Stmt **CatchStmts, unsigned NumCatchStmts,
566 Stmt *atFinallyStmt)
567 : Stmt(ObjCAtTryStmtClass), AtTryLoc(atTryLoc),
570 Stmt **Stmts = getStmts();
581 Stmt *atTryStmt,
582 Stmt **CatchStmts,
584 Stmt *atFinallyStmt) {
586 (1 + NumCatchStmts + (atFinallyStmt != 0)) * sizeof(Stmt *);
596 (1 + NumCatchStmts + HasFinally) * sizeof(Stmt *);
614 Stmt *tryBlock, Stmt **handlers,
617 Size += ((numHandlers + 1) * sizeof(Stmt));
626 Size += ((numHandlers + 1) * sizeof(Stmt));
632 CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock,
633 Stmt **handlers, unsigned numHandlers)
634 : Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(numHandlers) {
635 Stmt **Stmts = reinterpret_cast<Stmt **>(this + 1);
642 Stmt *Body, SourceLocation FL,
644 : Stmt(CXXForRangeStmtClass), ForLoc(FL), ColonLoc(CL), RParenLoc(RPL) {
647 SubExprs[COND] = reinterpret_cast<Stmt*>(Cond);
648 SubExprs[INC] = reinterpret_cast<Stmt*>(Inc);
675 Stmt *then, SourceLocation EL, Stmt *elsev)
676 : Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL)
679 SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
703 ForStmt::ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
704 Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
706 : Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
710 SubExprs[COND] = reinterpret_cast<Stmt*>(Cond);
711 SubExprs[INC] = reinterpret_cast<Stmt*>(Inc);
735 : Stmt(SwitchStmtClass), FirstCase(0), AllEnumCasesCovered(0)
738 SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
761 Stmt *SwitchCase::getSubStmt() {
767 WhileStmt::WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
769 : Stmt(WhileStmtClass) {
771 SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
813 Stmt *TryBlock,
814 Stmt *Handler)
815 : Stmt(SEHTryStmtClass),
826 Stmt *TryBlock,
827 Stmt *Handler) {
841 Stmt *Block)
842 : Stmt(SEHExceptStmtClass),
845 Children[FILTER_EXPR] = reinterpret_cast<Stmt*>(FilterExpr);
852 Stmt *Block) {
857 Stmt *Block)
858 : Stmt(SEHFinallyStmtClass),
865 Stmt *Block) {