[cfe-commits] r55357 - /cfe/trunk/lib/AST/DeclObjC.cpp

Daniel Dunbar daniel at zuster.org
Mon Aug 25 23:08:30 PDT 2008


Author: ddunbar
Date: Tue Aug 26 01:08:30 2008
New Revision: 55357

URL: http://llvm.org/viewvc/llvm-project?rev=55357&view=rev
Log:
Missed a file; part of:

Move implicit Obj-C param creation into ObjCMethodDecl.
 - Add ObjCMethodDecl::createImplicitParams.
 - Remove ObjCMethodDecl::set{Self,Cmd}Decl
 - Remove Sema::CreateImplicitParameter

No (intended) functionality change.

Modified:
    cfe/trunk/lib/AST/DeclObjC.cpp

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=55357&r1=55356&r2=55357&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Aug 26 01:08:30 2008
@@ -220,6 +220,31 @@
 // 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!");





More information about the cfe-commits mailing list