Convert ObjC statement actions to smart pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sebastian Redl 2009-01-18 17:43:11 +00:00
Родитель 3037ed0a27
Коммит 431e90e887
5 изменённых файлов: 101 добавлений и 100 удалений

Просмотреть файл

@ -381,37 +381,38 @@ namespace {
}
// Objective-c statements
virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, StmtTy *Parm,
StmtTy *Body, StmtTy *CatchList) {
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen,
StmtArg Parm, StmtArg Body,
StmtArg CatchList) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtTy *Body) {
virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtArg Body) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtTy *Try,
StmtTy *Catch, StmtTy *Finally) {
virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtArg Try, StmtArg Catch,
StmtArg Finally) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
StmtTy *Throw) {
virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
ExprArg Throw) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprTy *SynchExpr,
StmtTy *SynchBody) {
virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprArg SynchExpr,
StmtArg SynchBody) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
return StmtEmpty();
}
// C++ Statements

Просмотреть файл

@ -474,32 +474,33 @@ public:
}
// Objective-c statements
virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, StmtTy *Parm,
StmtTy *Body, StmtTy *CatchList) {
return 0;
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen,
StmtArg Parm, StmtArg Body,
StmtArg CatchList) {
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtTy *Body) {
return 0;
virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtArg Body) {
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtTy *Try,
StmtTy *Catch, StmtTy *Finally) {
return 0;
virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtArg Try, StmtArg Catch,
StmtArg Finally) {
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
StmtTy *Throw) {
return 0;
virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
ExprArg Throw) {
return StmtEmpty();
}
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprTy *SynchExpr,
StmtTy *SynchBody) {
return 0;
virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprArg SynchExpr,
StmtArg SynchBody) {
return StmtEmpty();
}
// C++ Statements

Просмотреть файл

@ -1202,7 +1202,7 @@ Parser::OwningStmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
}
}
ConsumeToken(); // consume ';'
return Owned(Actions.ActOnObjCAtThrowStmt(atLoc, Res.release()));
return Actions.ActOnObjCAtThrowStmt(atLoc, move_convert(Res));
}
/// objc-synchronized-statement:
@ -1239,8 +1239,8 @@ Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
BodyScope.Exit();
if (SynchBody.isInvalid())
SynchBody = Actions.ActOnNullStmt(Tok.getLocation());
return Owned(Actions.ActOnObjCAtSynchronizedStmt(atLoc, Res.release(),
SynchBody.release()));
return Actions.ActOnObjCAtSynchronizedStmt(atLoc, move_convert(Res),
move_convert(SynchBody));
}
/// objc-try-catch-statement:
@ -1313,8 +1313,8 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (CatchBody.isInvalid())
CatchBody = Actions.ActOnNullStmt(Tok.getLocation());
CatchStmts = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
RParenLoc, FirstPart.release(), CatchBody.release(),
CatchStmts.release());
RParenLoc, move_convert(FirstPart), move_convert(CatchBody),
move_convert(CatchStmts));
} else {
Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
<< "@catch clause";
@ -1334,7 +1334,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (FinallyBody.isInvalid())
FinallyBody = Actions.ActOnNullStmt(Tok.getLocation());
FinallyStmt = Actions.ActOnObjCAtFinallyStmt(AtCatchFinallyLoc,
FinallyBody.release());
move_convert(FinallyBody));
catch_or_finally_seen = true;
break;
}
@ -1343,9 +1343,9 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
Diag(atLoc, diag::err_missing_catch_finally);
return StmtError();
}
return Owned(Actions.ActOnObjCAtTryStmt(atLoc, TryBody.release(),
CatchStmts.release(),
FinallyStmt.release()));
return Actions.ActOnObjCAtTryStmt(atLoc, move_convert(TryBody),
move_convert(CatchStmts),
move_convert(FinallyStmt));
}
/// objc-method-def: objc-method-proto ';'[opt] '{' body '}'

Просмотреть файл

@ -912,23 +912,24 @@ public:
ExprArg AsmString,
MultiExprArg Clobbers,
SourceLocation RParenLoc);
virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, StmtTy *Parm,
StmtTy *Body, StmtTy *CatchList);
virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtTy *Body);
virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtTy *Try,
StmtTy *Catch, StmtTy *Finally);
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
StmtTy *Throw);
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprTy *SynchExpr,
StmtTy *SynchBody);
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen,
StmtArg Parm, StmtArg Body,
StmtArg CatchList);
virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtArg Body);
virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtArg Try,
StmtArg Catch, StmtArg Finally);
virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
ExprArg Throw);
virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprArg SynchExpr,
StmtArg SynchBody);
virtual DeclTy *ActOnExceptionDeclarator(Scope *S, Declarator &D);
virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,

Просмотреть файл

@ -935,44 +935,42 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
Clobbers, RParenLoc));
}
Action::StmtResult
Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, StmtTy *Parm,
StmtTy *Body, StmtTy *CatchList) {
ObjCAtCatchStmt *CS = new ObjCAtCatchStmt(AtLoc, RParen,
static_cast<Stmt*>(Parm), static_cast<Stmt*>(Body),
static_cast<Stmt*>(CatchList));
return CatchList ? CatchList : CS;
Action::OwningStmtResult
Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, StmtArg Parm,
StmtArg Body, StmtArg catchList) {
Stmt *CatchList = static_cast<Stmt*>(catchList.release());
ObjCAtCatchStmt *CS = new ObjCAtCatchStmt(AtLoc, RParen,
static_cast<Stmt*>(Parm.release()), static_cast<Stmt*>(Body.release()),
CatchList);
return Owned(CatchList ? CatchList : CS);
}
Action::StmtResult
Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, StmtTy *Body) {
ObjCAtFinallyStmt *FS = new ObjCAtFinallyStmt(AtLoc,
static_cast<Stmt*>(Body));
return FS;
Action::OwningStmtResult
Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, StmtArg Body) {
return Owned(new ObjCAtFinallyStmt(AtLoc,
static_cast<Stmt*>(Body.release())));
}
Action::StmtResult
Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtTy *Try, StmtTy *Catch, StmtTy *Finally) {
ObjCAtTryStmt *TS = new ObjCAtTryStmt(AtLoc, static_cast<Stmt*>(Try),
static_cast<Stmt*>(Catch),
static_cast<Stmt*>(Finally));
return TS;
Action::OwningStmtResult
Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtArg Try, StmtArg Catch, StmtArg Finally) {
return Owned(new ObjCAtTryStmt(AtLoc, static_cast<Stmt*>(Try.release()),
static_cast<Stmt*>(Catch.release()),
static_cast<Stmt*>(Finally.release())));
}
Action::StmtResult
Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, StmtTy *Throw) {
ObjCAtThrowStmt *TS = new ObjCAtThrowStmt(AtLoc, static_cast<Stmt*>(Throw));
return TS;
Action::OwningStmtResult
Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg Throw) {
return Owned(new ObjCAtThrowStmt(AtLoc, static_cast<Expr*>(Throw.release())));
}
Action::StmtResult
Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, ExprTy *SynchExpr,
StmtTy *SynchBody) {
ObjCAtSynchronizedStmt *SS = new ObjCAtSynchronizedStmt(AtLoc,
static_cast<Stmt*>(SynchExpr), static_cast<Stmt*>(SynchBody));
return SS;
Action::OwningStmtResult
Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, ExprArg SynchExpr,
StmtArg SynchBody) {
return Owned(new ObjCAtSynchronizedStmt(AtLoc,
static_cast<Stmt*>(SynchExpr.release()),
static_cast<Stmt*>(SynchBody.release())));
}
/// ActOnCXXCatchBlock - Takes an exception declaration and a handler block