From f87ca0a7d13e33c0e9e5bf0ac64d1392e3c2c0aa Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 16 Mar 2008 01:23:04 +0000 Subject: Give ObjCProtocolDecl a Create method. llvm-svn: 48410 --- clang/lib/AST/DeclObjC.cpp | 8 ++++++++ clang/lib/Sema/SemaDeclObjC.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 53ba8c12194..17b1d28cadb 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -47,6 +47,14 @@ ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, SourceLocation L, return new (Mem) ObjCIvarDecl(L, Id, T); } +ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, SourceLocation L, + unsigned numRefProtos, + IdentifierInfo *Id, + bool ForwardDecl) { + void *Mem = C.getAllocator().Allocate(); + return new (Mem) ObjCProtocolDecl(L, numRefProtos, Id, ForwardDecl); +} + //===----------------------------------------------------------------------===// // Objective-C Decl Implementation diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index d5d658d4ff1..af57d09ce62 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -211,10 +211,10 @@ Sema::DeclTy *Sema::ActOnStartProtocolInterface( } } else { - PDecl = new ObjCProtocolDecl(AtProtoInterfaceLoc, NumProtoRefs, - ProtocolName); + PDecl = ObjCProtocolDecl::Create(Context, AtProtoInterfaceLoc, NumProtoRefs, + ProtocolName); ObjCProtocols[ProtocolName] = PDecl; - } + } if (NumProtoRefs) { /// Check then save referenced protocols @@ -260,7 +260,7 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, ObjCProtocolDecl *PDecl = ObjCProtocols[P]; if (!PDecl) { // Not already seen? // FIXME: Pass in the location of the identifier! - PDecl = new ObjCProtocolDecl(AtProtocolLoc, 0, P, true); + PDecl = ObjCProtocolDecl::Create(Context, AtProtocolLoc, 0, P, true); ObjCProtocols[P] = PDecl; } -- cgit v1.2.3