// Create Decl objects for each parameter, adding them to the FunctionDecl.
llvm::SmallVector<ParmVarDecl*, 16> Params;
+ ParmVarDecl *PDecl;
+ // Insert the invisible arguments!
+ if (MDecl->isInstance())
+ // FIXME: type is wrong.
+ PDecl = new ParmVarDecl(SourceLocation(/*FIXME*/),
+ &Context.Idents.get("self"),
+ Context.getObjcIdType(), VarDecl::None, 0);
+ else
+ PDecl = new ParmVarDecl(SourceLocation(/*FIXME*/),
+ &Context.Idents.get("self"),
+ Context.getObjcIdType(), VarDecl::None, 0);
+ Params.push_back(ObjcParseParamDeclarator(PDecl, FnBodyScope));
+ PDecl = new ParmVarDecl(SourceLocation(/*FIXME*/),
+ &Context.Idents.get("_cmd"),
+ Context.getObjcSelType(), VarDecl::None, 0);
+ Params.push_back(ObjcParseParamDeclarator(PDecl, FnBodyScope));
+
for (int i = 0; i < MDecl->getNumParams(); i++) {
- ParmVarDecl *PDecl = MDecl->getParamDecl(i);
+ PDecl = MDecl->getParamDecl(i);
Params.push_back(ObjcParseParamDeclarator(PDecl, FnBodyScope));
}
return T;
}
-/// GetTypeForDeclarator - Convert the type for the specified declarator to Type
+/// ObjcGetTypeForDeclarator - Convert the type for the specified declarator to Type
/// instances.
QualType Sema::ObjcGetTypeForDeclarator(DeclTy *D, Scope *S) {
ObjcMethodDecl *MDecl = dyn_cast<ObjcMethodDecl>(static_cast<Decl *>(D));
QualType T = MDecl->getResultType();
llvm::SmallVector<QualType, 16> ArgTys;
+ // Add the first two invisible argument types for self and _cmd.
+ if (MDecl->isInstance())
+ // FIXME: interface-name *
+ ArgTys.push_back(Context.getObjcIdType());
+ else
+ ArgTys.push_back(Context.getObjcIdType());
+ ArgTys.push_back(Context.getObjcSelType());
+
for (int i = 0; i < MDecl->getNumParams(); i++) {
ParmVarDecl *PDecl = MDecl->getParamDecl(i);
QualType ArgTy = PDecl->getType();