From 439d28c1be7abc962afeb6a30f621b7b3b8bb13f Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 10 Nov 2007 17:40:57 +0000 Subject: [PATCH] Minor code clean up in method def area. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43980 91177308-0d34-0410-b5e6-96231b3b80d8 --- Sema/Sema.h | 2 +- Sema/SemaDecl.cpp | 6 +++--- include/clang/Parse/Action.h | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Sema/Sema.h b/Sema/Sema.h index 31b54106db..2d6c42593b 100644 --- a/Sema/Sema.h +++ b/Sema/Sema.h @@ -190,7 +190,7 @@ private: virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group); virtual DeclTy *ActOnStartOfFunctionDef(Scope *S, Declarator &D); - virtual DeclTy *ObjcActOnStartOfMethodDef(Scope *S, DeclTy *D); + virtual void ObjcActOnStartOfMethodDef(Scope *S, DeclTy *D); virtual DeclTy *ActOnFunctionDefBody(DeclTy *Decl, StmtTy *Body); virtual void ActOnMethodDefBody(DeclTy *Decl, StmtTy *Body); diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 65e7af5321..7ba743cf5e 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -1030,6 +1030,8 @@ void Sema::ActOnMethodDefBody(DeclTy *D, StmtTy *Body) { // Verify and clean out per-function state. + // TODO: This code block is common with ActOnFunctionDefBody and need be + // refactored. // Check goto/label use. for (llvm::DenseMap::iterator I = LabelMap.begin(), E = LabelMap.end(); I != E; ++I) { @@ -1053,7 +1055,7 @@ void Sema::ActOnMethodDefBody(DeclTy *D, StmtTy *Body) { /// ObjcActOnStartOfMethodDef - This routine sets up parameters; invisible /// and user declared, in the method definition's AST. -Sema::DeclTy *Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { +void Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { assert(CurFunctionDecl == 0 && "Function parsing confused"); ObjcMethodDecl *MDecl = dyn_cast(static_cast(D)); @@ -1094,8 +1096,6 @@ Sema::DeclTy *Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { } FD->setParams(&Params[0], Params.size()); - - return FD; } /// ImplicitlyDefineFunction - An undeclared identifier was used in a function diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index ec9d4e30dd..0166e30e7c 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -135,9 +135,8 @@ public: return ActOnDeclarator(FnBodyScope, D, 0); } - virtual DeclTy *ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { - // Default to ObjcActOnMethodDefinition. - return ObjcActOnMethodDefinition(FnBodyScope, D, 0); + virtual void ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { + return; } /// ActOnFunctionDefBody - This is called when a function body has completed -- 2.40.0