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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102222
91177308-0d34-0410-b5e6-
96231b3b80d8
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
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 '...'
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);
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 &&
}
}
+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;
+}