]> granicus.if.org Git - clang/commitdiff
Simplify setting of DeclContext for @catch variable
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 3 Feb 2010 00:32:51 +0000 (00:32 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 3 Feb 2010 00:32:51 +0000 (00:32 +0000)
(per Doug's comment).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95169 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
lib/Sema/SemaDecl.cpp

index e837c765bff260a8e3e0a6fa48afa0f2d9c4d438..ef65204e8c36b1aa67914eeebbcb79a3a3f13435 100644 (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
index 8c217f8e0d2705d18b6f98681c980512fdece79e..d203376f91bae8efaba8fd6b50156eb844a4e408 100644 (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,