Insert invisble arguments to method definition header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43948 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 4f7ffc3..0098f8b 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1045,9 +1045,26 @@
// 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));
}