[cfe-commits] r102222 - in /cfe/trunk: include/clang/Parse/Action.h lib/Parse/ParseObjc.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclObjC.cpp
Douglas Gregor
dgregor at apple.com
Fri Apr 23 16:01:43 PDT 2010
Author: dgregor
Date: Fri Apr 23 18:01:43 2010
New Revision: 102222
URL: http://llvm.org/viewvc/llvm-project?rev=102222&view=rev
Log:
Rework Parser-Sema interface for Objective-C @catch exception object
arguments. Rather than having the parser call ActOnParamDeclarator
(which is a bit of a hack), call a new ActOnObjCExceptionDecl
action. We'll be moving more functionality into this handler to
perform earlier checking of @catch.
Modified:
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=102222&r1=102221&r2=102222&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Fri Apr 23 18:01:43 2010
@@ -468,7 +468,11 @@
virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D) {
return DeclPtrTy();
}
- virtual void ActOnObjCCatchParam(DeclPtrTy D) {
+
+ /// \brief Parsed an exception object declaration within an Objective-C
+ /// @catch statement.
+ virtual DeclPtrTy ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
+ return DeclPtrTy();
}
/// AddInitializerToDecl - This action is called immediately after
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=102222&r1=102221&r2=102222&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Apr 23 18:01:43 2010
@@ -1542,11 +1542,9 @@
Declarator ParmDecl(DS, Declarator::PrototypeContext);
ParseDeclarator(ParmDecl);
- // Inform the actions module about the parameter declarator, so it
+ // Inform the actions module about the 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);
+ FirstPart = Actions.ActOnObjCExceptionDecl(CurScope, ParmDecl);
} else
ConsumeToken(); // consume '...'
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=102222&r1=102221&r2=102222&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Fri Apr 23 18:01:43 2010
@@ -812,7 +812,7 @@
SourceLocation NameLoc,
VarDecl::StorageClass StorageClass,
VarDecl::StorageClass StorageClassAsWritten);
- virtual void ActOnObjCCatchParam(DeclPtrTy D);
+ virtual DeclPtrTy ActOnObjCExceptionDecl(Scope *S, Declarator &D);
virtual void ActOnParamDefaultArgument(DeclPtrTy param,
SourceLocation EqualLoc,
ExprArg defarg);
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=102222&r1=102221&r2=102222&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Apr 23 18:01:43 2010
@@ -4258,11 +4258,6 @@
return New;
}
-void Sema::ActOnObjCCatchParam(DeclPtrTy D) {
- ParmVarDecl *Param = cast<ParmVarDecl>(D.getAs<Decl>());
- Param->setDeclContext(CurContext);
-}
-
void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
SourceLocation LocAfterDecls) {
assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function &&
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=102222&r1=102221&r2=102222&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Apr 23 18:01:43 2010
@@ -1707,3 +1707,10 @@
}
}
+Sema::DeclPtrTy Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
+ // FIXME: Perform checking on the declaration here.
+ DeclPtrTy Dcl = ActOnParamDeclarator(S, D);
+ if (Dcl.get())
+ cast<ParmVarDecl>(Dcl.getAs<Decl>())->setDeclContext(CurContext);
+ return Dcl;
+}
More information about the cfe-commits
mailing list