diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-26 17:32:49 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-26 17:32:49 +0000 |
commit | 160b5630aa781ac348303e1ae088d27016637778 (patch) | |
tree | 8f53672217438eeb68f12514ba7b6acc8679fe31 /lib/Sema/SemaStmt.cpp | |
parent | c00d8e18ad3d903acfeb5d05163ce90713066a3f (diff) |
Refactor Objective-C @catch parameter checking by detangling it from
function-parameter checking and splitting it into the normal
ActOn*/Build* pair in Sema. We now use VarDecl to represent the @catch
parameter rather than the ill-fitting ParmVarDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index a5292efea1..9d6132d050 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1527,23 +1527,11 @@ Action::OwningStmtResult Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, DeclPtrTy Parm, StmtArg Body) { - ParmVarDecl *PVD = cast_or_null<ParmVarDecl>(Parm.getAs<Decl>()); - - // PVD == 0 implies @catch(...). - if (PVD) { - // If we already know the decl is invalid, reject it. - if (PVD->isInvalidDecl()) - return StmtError(); - - if (!PVD->getType()->isObjCObjectPointerType()) - return StmtError(Diag(PVD->getLocation(), - diag::err_catch_param_not_objc_type)); - if (PVD->getType()->isObjCQualifiedIdType()) - return StmtError(Diag(PVD->getLocation(), - diag::err_illegal_qualifiers_on_catch_parm)); - } - - return Owned(new (Context) ObjCAtCatchStmt(AtLoc, RParen, PVD, + VarDecl *Var = cast_or_null<VarDecl>(Parm.getAs<Decl>()); + if (Var && Var->isInvalidDecl()) + return StmtError(); + + return Owned(new (Context) ObjCAtCatchStmt(AtLoc, RParen, Var, Body.takeAs<Stmt>())); } |