From 2f764f11f513c7b51c716fffa5d02e5de816836f Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 3 Feb 2010 00:01:43 +0000 Subject: Fix DeclContext of an objective-c @catch variable declaration. Fixes radar 7590273. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95164 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/Sema/SemaDecl.cpp') diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index c604f6a4ee..8c217f8e0d 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3934,6 +3934,19 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { return DeclPtrTy::make(New); } +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? + +} + void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls) { assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function && -- cgit v1.2.3-18-g5258