summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/DeclObjC.cpp14
-rw-r--r--clang/lib/Sema/Sema.cpp5
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp10
4 files changed, 24 insertions, 7 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 9580e0cbf85..53ba8c12194 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -30,7 +30,21 @@ ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C, SourceLocation beginLoc,
return new (Mem) ObjCMethodDecl(beginLoc, endLoc, SelInfo, T, contextDecl,
M, isInstance,
isVariadic, impControl);
+}
+
+ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,SourceLocation atLoc,
+ unsigned numRefProtos,
+ IdentifierInfo *Id,
+ bool ForwardDecl, bool isInternal){
+ void *Mem = C.getAllocator().Allocate<ObjCInterfaceDecl>();
+ return new (Mem) ObjCInterfaceDecl(atLoc, numRefProtos, Id, ForwardDecl,
+ isInternal);
+}
+ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, SourceLocation L,
+ IdentifierInfo *Id, QualType T) {
+ void *Mem = C.getAllocator().Allocate<ObjCIvarDecl>();
+ return new (Mem) ObjCIvarDecl(L, Id, T);
}
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index f4c271cdcb1..da78ec06787 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -108,8 +108,9 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
Context.setObjCClassType(ClassTypedef);
// Synthesize "@class Protocol;
- ObjCInterfaceDecl *ProtocolDecl = new ObjCInterfaceDecl(SourceLocation(), 0,
- &Context.Idents.get("Protocol"), true);
+ ObjCInterfaceDecl *ProtocolDecl =
+ ObjCInterfaceDecl::Create(Context, SourceLocation(), 0,
+ &Context.Idents.get("Protocol"), true);
Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl));
// Synthesize "typedef struct objc_object { Class isa; } *id;"
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 28b396a8f0d..5ac51b29bfc 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1340,7 +1340,7 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *TagDecl,
// properties can appear within a protocol.
// See corresponding FIXME in DeclObjC.h:ObjCPropertyDecl.
isa<ObjCProtocolDecl>(static_cast<Decl *>(TagDecl)))
- NewFD = new ObjCIvarDecl(Loc, II, T);
+ NewFD = ObjCIvarDecl::Create(Context, Loc, II, T);
else
assert(0 && "Sema::ActOnField(): Unknown TagDecl");
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 4dd84d8555e..d5d658d4ff1 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -98,7 +98,8 @@ Sema::DeclTy *Sema::ActOnStartClassInterface(
}
}
else {
- IDecl = new ObjCInterfaceDecl(AtInterfaceLoc, NumProtocols, ClassName);
+ IDecl = ObjCInterfaceDecl::Create(Context, AtInterfaceLoc, NumProtocols,
+ ClassName);
// Chain & install the interface decl into the identifier.
IDecl->setNext(ClassName->getFETokenInfo<ScopedDecl>());
@@ -382,8 +383,8 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
if (!IDecl) {
// Legacy case of @implementation with no corresponding @interface.
// Build, chain & install the interface decl into the identifier.
- IDecl = new ObjCInterfaceDecl(AtClassImplLoc, 0, ClassName,
- false, true);
+ IDecl = ObjCInterfaceDecl::Create(Context, AtClassImplLoc, 0, ClassName,
+ false, true);
IDecl->setNext(ClassName->getFETokenInfo<ScopedDecl>());
ClassName->setFETokenInfo(IDecl);
IDecl->setSuperClass(SDecl);
@@ -589,7 +590,8 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
}
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!IDecl) { // Not already seen? Make a forward decl.
- IDecl = new ObjCInterfaceDecl(AtClassLoc, 0, IdentList[i], true);
+ IDecl = ObjCInterfaceDecl::Create(Context, AtClassLoc, 0, IdentList[i],
+ true);
// Chain & install the interface decl into the identifier.
IDecl->setNext(IdentList[i]->getFETokenInfo<ScopedDecl>());
IdentList[i]->setFETokenInfo(IDecl);
OpenPOWER on IntegriCloud