[cfe-commits] r95169 - in /cfe/trunk/lib: Parse/ParseObjc.cpp Sema/SemaDecl.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Feb 2 16:32:51 PST 2010


Author: fjahanian
Date: Tue Feb  2 18:32:51 2010
New Revision: 95169

URL: http://llvm.org/viewvc/llvm-project?rev=95169&view=rev
Log:
Simplify setting of DeclContext for @catch variable
(per Doug's comment).

Modified:
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=95169&r1=95168&r2=95169&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Tue Feb  2 18:32:51 2010
@@ -1481,6 +1481,7 @@
 
           // 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

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=95169&r1=95168&r2=95169&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Feb  2 18:32:51 2010
@@ -3936,15 +3936,7 @@
 
 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,





More information about the cfe-commits mailing list