public:
ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
- Stmt *catchVarStmtDecl, Stmt *atCatchStmt, Stmt *atCatchList);
+ DeclStmt *catchVarStmtDecl,
+ Stmt *atCatchStmt, Stmt *atCatchList);
const Stmt *getCatchBody() const { return SubExprs[BODY]; }
Stmt *getCatchBody() { return SubExprs[BODY]; }
return static_cast<ObjCAtCatchStmt*>(SubExprs[NEXT_CATCH]);
}
- const Stmt *getCatchParamStmt() const { return SubExprs[SELECTOR]; }
- Stmt *getCatchParamStmt() { return SubExprs[SELECTOR]; }
+ const DeclStmt *getCatchParamStmt() const {
+ return static_cast<const DeclStmt*>(SubExprs[SELECTOR]); }
+ DeclStmt *getCatchParamStmt() {
+ return static_cast<DeclStmt*>(SubExprs[SELECTOR]);
+ }
SourceLocation getRParenLoc() const { return RParenLoc; }
ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc,
SourceLocation rparenloc,
- Stmt *catchVarStmtDecl, Stmt *atCatchStmt,
+ DeclStmt *catchVarStmtDecl, Stmt *atCatchStmt,
Stmt *atCatchList)
: Stmt(ObjCAtCatchStmtClass) {
SubExprs[SELECTOR] = catchVarStmtDecl;
SubExprs[BODY] = atCatchStmt;
SubExprs[NEXT_CATCH] = NULL;
+ // FIXME: O(N^2) in number of catch blocks.
if (atCatchList) {
ObjCAtCatchStmt *AtCatchList = static_cast<ObjCAtCatchStmt*>(atCatchList);
for (; CatchStmt; CatchStmt = CatchStmt->getNextCatchStmt()) {
llvm::BasicBlock *NextCatchBlock = CGF.createBasicBlock("catch");
- const DeclStmt *CatchParam =
- cast_or_null<DeclStmt>(CatchStmt->getCatchParamStmt());
+ const DeclStmt *CatchParam = CatchStmt->getCatchParamStmt();
const VarDecl *VD = 0;
const PointerType *PT = 0;
StmtArg Body, StmtArg catchList) {
Stmt *CatchList = static_cast<Stmt*>(catchList.release());
ObjCAtCatchStmt *CS = new (Context) ObjCAtCatchStmt(AtLoc, RParen,
- static_cast<Stmt*>(Parm.release()), static_cast<Stmt*>(Body.release()),
+ static_cast<DeclStmt*>(Parm.release()), static_cast<Stmt*>(Body.release()),
CatchList);
return Owned(CatchList ? CatchList : CS);
}