From: Fariborz Jahanian Date: Wed, 3 Feb 2010 00:32:51 +0000 (+0000) Subject: Simplify setting of DeclContext for @catch variable X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d219a3a462c31fc9aa0c0bcfb749e9e8e56b5e35;p=clang Simplify setting of DeclContext for @catch variable (per Doug's comment). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95169 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index e837c765bf..ef65204e8c 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -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 diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 8c217f8e0d..d203376f91 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3936,15 +3936,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { void Sema::ActOnObjCCatchParam(DeclPtrTy D) { ParmVarDecl *Param = cast(D.getAs()); - - if (FunctionDecl *Function = dyn_cast(CurContext)) - Param->setDeclContext(Function); - else if (CXXMethodDecl *MD = dyn_cast(CurContext)) - Param->setDeclContext(MD); - else if (BlockDecl *BD = dyn_cast(CurContext)) - Param->setDeclContext(BD); - // FIXME. Other contexts? - + Param->setDeclContext(CurContext); } void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,