Simplify setting of DeclContext for @catch variable

(per Doug's comment).

llvm-svn: 95169
This commit is contained in:
Fariborz Jahanian 2010-02-03 00:32:51 +00:00
parent 249453fff0
commit e165191990
2 changed files with 2 additions and 9 deletions

View File

@ -1481,6 +1481,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
// Inform the actions module about the parameter declarator, so it
// gets added to the current scope.
// FIXME. Probably can build a VarDecl and avoid setting DeclContext.
FirstPart = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
Actions.ActOnObjCCatchParam(FirstPart);
} else

View File

@ -3936,15 +3936,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
void Sema::ActOnObjCCatchParam(DeclPtrTy D) {
ParmVarDecl *Param = cast<ParmVarDecl>(D.getAs<Decl>());
if (FunctionDecl *Function = dyn_cast<FunctionDecl>(CurContext))
Param->setDeclContext(Function);
else if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext))
Param->setDeclContext(MD);
else if (BlockDecl *BD = dyn_cast<BlockDecl>(CurContext))
Param->setDeclContext(BD);
// FIXME. Other contexts?
Param->setDeclContext(CurContext);
}
void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,