aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-26 06:08:30 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-26 06:08:30 +0000
commit08a356cc2b98cff990ef6969e819a214443d7f8f (patch)
tree647b49364466d582c458f55278cd4f6649c62688 /lib/AST/DeclObjC.cpp
parent451318c08a6342c10b8986060386fd9274418437 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index a7805f376c..9da6dafb98 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -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!");