Move implicit Obj-C param creation into ObjCMethodDecl.
- Add ObjCMethodDecl::createImplicitParams.
- Remove ObjCMethodDecl::set{Self,Cmd}Decl
- Remove Sema::CreateImplicitParameter
No (intended) functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55356 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index b02df05..d98c306 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -40,28 +40,12 @@
// 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!
- PI.Ident = &Context.Idents.get("self");
- PI.IdentLoc = SourceLocation(); // synthesized vars have a null location.
- QualType selfTy;
- if (MDecl->isInstance()) {
- selfTy = Context.getObjCIdType();
- if (ObjCInterfaceDecl *OID = MDecl->getClassInterface()) {
- // There may be no interface context due to error in declaration of the
- // interface (which has been reported). Recover gracefully
- selfTy = Context.getObjCInterfaceType(OID);
- selfTy = Context.getPointerType(selfTy);
- }
- } else // we have a factory method.
- selfTy = Context.getObjCClassType();
- getCurMethodDecl()->setSelfDecl(CreateImplicitParameter(FnBodyScope,
- PI.Ident, PI.IdentLoc, selfTy));
+ MDecl->createImplicitParams(Context);
- PI.Ident = &Context.Idents.get("_cmd");
- getCurMethodDecl()->setCmdDecl(CreateImplicitParameter(FnBodyScope,
- PI.Ident, PI.IdentLoc, Context.getObjCSelType()));
+ PushOnScopeChains(MDecl->getSelfDecl(), FnBodyScope);
+ PushOnScopeChains(MDecl->getCmdDecl(), FnBodyScope);
// Introduce all of the other parameters into this scope.
for (unsigned i = 0, e = MDecl->getNumParams(); i != e; ++i) {