]> granicus.if.org Git - clang/commitdiff
Missed a file; part of:
authorDaniel Dunbar <daniel@zuster.org>
Tue, 26 Aug 2008 06:08:30 +0000 (06:08 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 26 Aug 2008 06:08:30 +0000 (06:08 +0000)
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@55357 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclObjC.cpp

index a7805f376cb974685f2d18099c8616a84a86df47..9da6dafb98d90ac54969cafee83df65f50b6139b 100644 (file)
@@ -220,6 +220,31 @@ ObjCPropertyDecl *ObjCPropertyDecl::Create(ASTContext &C,
 // Objective-C Decl Implementation
 //===----------------------------------------------------------------------===//
 
+void ObjCMethodDecl::createImplicitParams(ASTContext &Context) {
+  QualType selfTy;
+  if (isInstance()) {
+    // There may be no interface context due to error in declaration
+    // of the interface (which has been reported). Recover gracefully.
+    if (ObjCInterfaceDecl *OID = getClassInterface()) {
+      selfTy = Context.getObjCInterfaceType(OID);
+      selfTy = Context.getPointerType(selfTy);
+    } else {
+      selfTy = Context.getObjCIdType();
+    }
+  } else // we have a factory method.
+    selfTy = Context.getObjCClassType();
+
+  SelfDecl = ImplicitParamDecl::Create(Context, this, 
+                                       SourceLocation(), 
+                                       &Context.Idents.get("self"),
+                                       selfTy, 0);
+
+  CmdDecl = ImplicitParamDecl::Create(Context, this, 
+                                      SourceLocation(), 
+                                      &Context.Idents.get("_cmd"), 
+                                      Context.getObjCSelType(), 0);
+}
+
 void ObjCMethodDecl::setMethodParams(ParmVarDecl **NewParamInfo,
                                      unsigned NumParams) {
   assert(ParamInfo == 0 && "Already has param info!");