aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/DeclObjC.cpp8
-rw-r--r--lib/Sema/SemaDeclObjC.cpp8
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 53ba8c1219..17b1d28cad 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/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<ObjCProtocolDecl>();
+ return new (Mem) ObjCProtocolDecl(L, numRefProtos, Id, ForwardDecl);
+}
+
//===----------------------------------------------------------------------===//
// Objective-C Decl Implementation
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index d5d658d4ff..af57d09ce6 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/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;
}