aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-16 20:34:23 +0000
committerChris Lattner <sabre@nondot.org>2008-03-16 20:34:23 +0000
commit61f9d41036e30ff80130f99b31c0626e3ef057cc (patch)
treeff0c1c447a95b18ef4eef0998ac081abb583a332 /lib
parent62db2f4214c1589082960f12c9cb8924fe0cf8c5 (diff)
Add create methods for ObjCCategoryDecl, ObjCForwardProtocolDecl, ObjCClassDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/DeclObjC.cpp20
-rw-r--r--lib/Sema/SemaDeclObjC.cpp12
2 files changed, 27 insertions, 5 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 62336b67bd..2ec9395644 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -54,6 +54,26 @@ ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, SourceLocation L,
return new (Mem) ObjCProtocolDecl(L, numRefProtos, Id);
}
+ObjCClassDecl *ObjCClassDecl::Create(ASTContext &C, SourceLocation L,
+ ObjCInterfaceDecl **Elts, unsigned nElts) {
+ void *Mem = C.getAllocator().Allocate<ObjCClassDecl>();
+ return new (Mem) ObjCClassDecl(L, Elts, nElts);
+}
+
+ObjCForwardProtocolDecl *
+ObjCForwardProtocolDecl::Create(ASTContext &C, SourceLocation L,
+ ObjCProtocolDecl **Elts, unsigned NumElts) {
+ void *Mem = C.getAllocator().Allocate<ObjCForwardProtocolDecl>();
+ return new (Mem) ObjCForwardProtocolDecl(L, Elts, NumElts);
+}
+
+ObjCCategoryDecl *ObjCCategoryDecl::Create(ASTContext &C, SourceLocation L,
+ unsigned numRefProtocol,
+ IdentifierInfo *Id) {
+ void *Mem = C.getAllocator().Allocate<ObjCCategoryDecl>();
+ return new (Mem) ObjCCategoryDecl(L, numRefProtocol, Id);
+}
+
//===----------------------------------------------------------------------===//
// Objective-C Decl Implementation
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 28a92c7ba2..7bdfd9e014 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -268,8 +268,8 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
Protocols.push_back(PDecl);
}
- return new ObjCForwardProtocolDecl(AtProtocolLoc,
- &Protocols[0], Protocols.size());
+ return ObjCForwardProtocolDecl::Create(Context, AtProtocolLoc,
+ &Protocols[0], Protocols.size());
}
Sema::DeclTy *Sema::ActOnStartCategoryInterface(
@@ -280,8 +280,9 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface(
SourceLocation EndProtoLoc) {
ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName);
- ObjCCategoryDecl *CDecl = new ObjCCategoryDecl(AtInterfaceLoc, NumProtoRefs,
- CategoryName);
+ ObjCCategoryDecl *CDecl =
+ ObjCCategoryDecl::Create(Context, AtInterfaceLoc, NumProtoRefs,
+ CategoryName);
CDecl->setClassInterface(IDecl);
/// Check that class of this category is already completely declared.
@@ -605,7 +606,8 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
Interfaces.push_back(IDecl);
}
- return new ObjCClassDecl(AtClassLoc, &Interfaces[0], Interfaces.size());
+ return ObjCClassDecl::Create(Context, AtClassLoc,
+ &Interfaces[0], Interfaces.size());
}