diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-12-04 19:20:11 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-12-04 19:20:11 +0000 |
commit | b107ce82d425939ce32fc3c02faf7c2364abc1a3 (patch) | |
tree | e08e45be44267da083b07b2f14d948befee0c039 /Sema/SemaDecl.cpp | |
parent | b6427f821de8cce1566fb6e755143ea0918d5543 (diff) |
Simplified setting up Method's scope before generating AST for its nody.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Sema/SemaDecl.cpp')
-rw-r--r-- | Sema/SemaDecl.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 920d9917d6..e2b1fdf134 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -963,32 +963,11 @@ void Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { ObjcMethodDecl *MDecl = dyn_cast<ObjcMethodDecl>(static_cast<Decl *>(D)); assert(MDecl != 0 && "Not a method declarator!"); - Scope *GlobalScope = FnBodyScope->getParent(); - - // build [classname selector-name] for the name of method. - std::string Name = "["; - Name += MDecl->getClassInterface()->getName(); - Name += " "; - Name += MDecl->getSelector().getName(); - Name += "]"; - IdentifierInfo *II = &Context.Idents.get(Name); - assert (II && "ObjcActOnStartOfMethodDef - selector name is missing"); - - QualType R = ObjcGetTypeForMethodDefinition(MDecl, GlobalScope); - assert(!R.isNull() && "ObjcActOnStartOfMethodDef() returned null type"); - - FunctionDecl *NewFD = new FunctionDecl(MDecl->getLocation(), II, R, - FunctionDecl::Static, false, 0); - NewFD->setNext(II->getFETokenInfo<ScopedDecl>()); - II->setFETokenInfo(NewFD); - GlobalScope->AddDecl(NewFD); - // Allow all of Sema to see that we are entering a method definition. CurMethodDecl = MDecl; - CurFunctionDecl = NewFD; - // Create Decl objects for each parameter, adding them to the FunctionDecl. - llvm::SmallVector<ParmVarDecl*, 16> Params; + // Create Decl objects for each parameter, entrring them in the scope for + // binding to their use. struct DeclaratorChunk::ParamInfo PI; // Insert the invisible arguments, self and _cmd! @@ -1001,20 +980,19 @@ void Sema::ObjcActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { PI.TypeInfo = selfTy.getAsOpaquePtr(); } else PI.TypeInfo = Context.getObjcIdType().getAsOpaquePtr(); - Params.push_back(ActOnParamDeclarator(PI, FnBodyScope)); + ActOnParamDeclarator(PI, FnBodyScope); PI.Ident = &Context.Idents.get("_cmd"); PI.TypeInfo = Context.getObjcSelType().getAsOpaquePtr(); - Params.push_back(ActOnParamDeclarator(PI, FnBodyScope)); + ActOnParamDeclarator(PI, FnBodyScope); for (int i = 0; i < MDecl->getNumParams(); i++) { ParmVarDecl *PDecl = MDecl->getParamDecl(i); PI.Ident = PDecl->getIdentifier(); PI.IdentLoc = PDecl->getLocation(); // user vars have a real location. PI.TypeInfo = PDecl->getType().getAsOpaquePtr(); - Params.push_back(ActOnParamDeclarator(PI, FnBodyScope)); + ActOnParamDeclarator(PI, FnBodyScope); } - NewFD->setParams(&Params[0], Params.size()); } /// ImplicitlyDefineFunction - An undeclared identifier was used in a function |