12#ifndef LLVM_CLANG_AST_STMTOBJC_H
13#define LLVM_CLANG_AST_STMTOBJC_H
16#include "llvm/Support/Compiler.h"
24 enum { ELEM, COLLECTION, BODY, END_EXPR };
25 Stmt* SubExprs[END_EXPR];
32 Stmt(ObjCForCollectionStmtClass,
Empty) { }
36 return reinterpret_cast<Expr*
>(SubExprs[COLLECTION]);
42 return reinterpret_cast<Expr*
>(SubExprs[COLLECTION]);
48 SubExprs[COLLECTION] =
reinterpret_cast<Stmt*
>(
E);
63 return T->getStmtClass() == ObjCForCollectionStmtClass;
68 return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
87 :
Stmt(ObjCAtCatchStmtClass), ExceptionDecl(catchVarDecl),
88 Body(atCatchStmt), AtCatchLoc(atCatchLoc), RParenLoc(rparenloc) { }
101 return ExceptionDecl;
116 return T->getStmtClass() == ObjCAtCatchStmtClass;
133 :
Stmt(ObjCAtFinallyStmtClass), AtFinallyLoc(atFinallyLoc),
134 AtFinallyStmt(atFinallyStmt) {}
152 return T->getStmtClass() == ObjCAtFinallyStmtClass;
156 return child_range(&AtFinallyStmt, &AtFinallyStmt+1);
167 private llvm::TrailingObjects<ObjCAtTryStmt, Stmt *> {
168 friend TrailingObjects;
169 size_t numTrailingObjects(OverloadToken<Stmt *>)
const {
170 return 1 + NumCatchStmts + HasFinally;
177 unsigned NumCatchStmts : 16;
180 LLVM_PREFERRED_TYPE(
bool)
181 unsigned HasFinally : 1;
188 Stmt **getStmts() {
return getTrailingObjects<Stmt *>(); }
189 Stmt *
const *getStmts()
const {
return getTrailingObjects<Stmt *>(); }
192 Stmt **CatchStmts,
unsigned NumCatchStmts,
193 Stmt *atFinallyStmt);
197 :
Stmt(ObjCAtTryStmtClass,
Empty), NumCatchStmts(NumCatchStmts),
198 HasFinally(HasFinally) { }
203 Stmt **CatchStmts,
unsigned NumCatchStmts,
204 Stmt *atFinallyStmt);
206 unsigned NumCatchStmts,
bool HasFinally);
223 assert(I < NumCatchStmts &&
"Out-of-bounds @catch index");
224 return cast_or_null<ObjCAtCatchStmt>(getStmts()[I + 1]);
229 assert(I < NumCatchStmts &&
"Out-of-bounds @catch index");
230 return cast_or_null<ObjCAtCatchStmt>(getStmts()[I + 1]);
235 assert(I < NumCatchStmts &&
"Out-of-bounds @catch index");
236 getStmts()[I + 1] = S;
244 return cast_or_null<ObjCAtFinallyStmt>(getStmts()[1 + NumCatchStmts]);
250 return cast_or_null<ObjCAtFinallyStmt>(getStmts()[1 + NumCatchStmts]);
253 assert(HasFinally &&
"@try does not have a @finally slot!");
254 getStmts()[1 + NumCatchStmts] = S;
261 return T->getStmtClass() == ObjCAtTryStmtClass;
266 getStmts(), getStmts() + numTrailingObjects(OverloadToken<Stmt *>()));
306 enum { SYNC_EXPR, SYNC_BODY, END_EXPR };
307 Stmt* SubStmts[END_EXPR];
312 :
Stmt(ObjCAtSynchronizedStmtClass) {
313 SubStmts[SYNC_EXPR] = synchExpr;
314 SubStmts[SYNC_BODY] = synchBody;
315 AtSynchronizedLoc = atSynchronizedLoc;
318 Stmt(ObjCAtSynchronizedStmtClass,
Empty) { }
324 return reinterpret_cast<CompoundStmt*
>(SubStmts[SYNC_BODY]);
327 return reinterpret_cast<CompoundStmt*
>(SubStmts[SYNC_BODY]);
332 return reinterpret_cast<Expr*
>(SubStmts[SYNC_EXPR]);
335 return reinterpret_cast<Expr*
>(SubStmts[SYNC_EXPR]);
345 return T->getStmtClass() == ObjCAtSynchronizedStmtClass;
349 return child_range(&SubStmts[0], &SubStmts[0]+END_EXPR);
364 :
Stmt(ObjCAtThrowStmtClass), Throw(throwExpr) {
365 AtThrowLoc = atThrowLoc;
379 return Throw ? Throw->
getEndLoc() : AtThrowLoc;
383 return T->getStmtClass() == ObjCAtThrowStmtClass;
400 :
Stmt(ObjCAutoreleasePoolStmtClass), AtLoc(atLoc), SubStmt(subStmt) {}
403 Stmt(ObjCAutoreleasePoolStmtClass,
Empty) { }
418 return T->getStmtClass() == ObjCAutoreleasePoolStmtClass;
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CompoundStmt - This represents a group of statements like { stmt stmt }.
SourceLocation getEndLoc() const
This represents one expression.
Represents Objective-C's @catch statement.
const VarDecl * getCatchParamDecl() const
const_child_range children() const
const Stmt * getCatchBody() const
SourceLocation getEndLoc() const LLVM_READONLY
ObjCAtCatchStmt(EmptyShell Empty)
void setCatchParamDecl(VarDecl *D)
void setCatchBody(Stmt *S)
static bool classof(const Stmt *T)
void setRParenLoc(SourceLocation Loc)
SourceLocation getAtCatchLoc() const
VarDecl * getCatchParamDecl()
ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc, VarDecl *catchVarDecl, Stmt *atCatchStmt)
SourceLocation getBeginLoc() const LLVM_READONLY
void setAtCatchLoc(SourceLocation Loc)
SourceLocation getRParenLoc() const
Represents Objective-C's @finally statement.
const Stmt * getFinallyBody() const
void setFinallyBody(Stmt *S)
SourceLocation getBeginLoc() const LLVM_READONLY
ObjCAtFinallyStmt(SourceLocation atFinallyLoc, Stmt *atFinallyStmt)
static bool classof(const Stmt *T)
void setAtFinallyLoc(SourceLocation Loc)
ObjCAtFinallyStmt(EmptyShell Empty)
SourceLocation getAtFinallyLoc() const
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
Represents Objective-C's @synchronized statement.
const Expr * getSynchExpr() const
CompoundStmt * getSynchBody()
ObjCAtSynchronizedStmt(SourceLocation atSynchronizedLoc, Stmt *synchExpr, Stmt *synchBody)
void setSynchBody(Stmt *S)
const CompoundStmt * getSynchBody() const
void setAtSynchronizedLoc(SourceLocation Loc)
SourceLocation getAtSynchronizedLoc() const
const_child_range children() const
SourceLocation getBeginLoc() const LLVM_READONLY
ObjCAtSynchronizedStmt(EmptyShell Empty)
void setSynchExpr(Stmt *S)
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
Represents Objective-C's @throw statement.
const Expr * getThrowExpr() const
void setThrowLoc(SourceLocation Loc)
static bool classof(const Stmt *T)
ObjCAtThrowStmt(SourceLocation atThrowLoc, Stmt *throwExpr)
const_child_range children() const
SourceLocation getThrowLoc() const LLVM_READONLY
void setThrowExpr(Stmt *S)
SourceLocation getBeginLoc() const LLVM_READONLY
ObjCAtThrowStmt(EmptyShell Empty)
SourceLocation getEndLoc() const LLVM_READONLY
Represents Objective-C's @try ... @catch ... @finally statement.
void setAtTryLoc(SourceLocation Loc)
llvm::iterator_range< const_catch_stmt_iterator > catch_const_range
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
void setFinallyStmt(Stmt *S)
catch_stmt_iterator catch_stmts_end()
const_child_range children() const
static ObjCAtTryStmt * CreateEmpty(const ASTContext &Context, unsigned NumCatchStmts, bool HasFinally)
llvm::iterator_range< catch_stmt_iterator > catch_range
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
catch_stmt_iterator catch_stmts_begin()
ObjCAtFinallyStmt * getFinallyStmt()
SourceLocation getBeginLoc() const LLVM_READONLY
void setCatchStmt(unsigned I, ObjCAtCatchStmt *S)
Set a particular catch statement.
static bool classof(const Stmt *T)
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
const Stmt * getTryBody() const
Retrieve the @try body.
catch_const_range catch_stmts() const
SourceLocation getEndLoc() const LLVM_READONLY
const_catch_stmt_iterator catch_stmts_begin() const
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
const_catch_stmt_iterator catch_stmts_end() const
ObjCAtCatchStmt * getCatchStmt(unsigned I)
Retrieve a @catch statement.
catch_range catch_stmts()
Represents Objective-C's @autoreleasepool Statement.
void setAtLoc(SourceLocation Loc)
const_child_range children() const
ObjCAutoreleasePoolStmt(EmptyShell Empty)
SourceLocation getAtLoc() const
static bool classof(const Stmt *T)
SourceLocation getBeginLoc() const LLVM_READONLY
ObjCAutoreleasePoolStmt(SourceLocation atLoc, Stmt *subStmt)
const Stmt * getSubStmt() const
SourceLocation getEndLoc() const LLVM_READONLY
Represents Objective-C's collection statement.
ObjCForCollectionStmt(EmptyShell Empty)
const Stmt * getElement() const
void setCollection(Expr *E)
void setForLoc(SourceLocation Loc)
SourceLocation getForLoc() const
const_child_range children() const
static bool classof(const Stmt *T)
void setRParenLoc(SourceLocation Loc)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getRParenLoc() const
const Expr * getCollection() const
const Stmt * getBody() const
SourceLocation getBeginLoc() const LLVM_READONLY
Encodes a location in the source.
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
llvm::iterator_range< child_iterator > child_range
llvm::iterator_range< const_child_iterator > const_child_range
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
const FunctionProtoType * T
Iterator for iterating over Stmt * arrays that contain only T *.
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....