start switching decls over to using an allocator controlled by ASTContext.
Right now only some ctors are switched over. I need to switch them all
over so I can change the dtor over.
This lets us experiment with region allocation and other things in the
future.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48390 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.cpp b/Sema/Sema.cpp
index 5b7a309..d854919 100644
--- a/Sema/Sema.cpp
+++ b/Sema/Sema.cpp
@@ -59,15 +59,16 @@
TUScope->AddDecl(IDecl);
// Synthesize "typedef struct objc_selector *SEL;"
- RecordDecl *SelTag = new RecordDecl(Decl::Struct, SourceLocation(),
- &Context.Idents.get("objc_selector"), 0);
+ RecordDecl *SelTag = RecordDecl::Create(Decl::Struct, SourceLocation(),
+ &Context.Idents.get("objc_selector"),
+ 0, Context);
SelTag->getIdentifier()->setFETokenInfo(SelTag);
TUScope->AddDecl(SelTag);
QualType SelT = Context.getPointerType(Context.getTagDeclType(SelTag));
- TypedefDecl *SelTypedef = new TypedefDecl(SourceLocation(),
- &Context.Idents.get("SEL"),
- SelT, 0);
+ TypedefDecl *SelTypedef = TypedefDecl::Create(SourceLocation(),
+ &Context.Idents.get("SEL"),
+ SelT, 0, Context);
SelTypedef->getIdentifier()->setFETokenInfo(SelTypedef);
TUScope->AddDecl(SelTypedef);
Context.setObjCSelType(SelTypedef);
@@ -96,12 +97,12 @@
// and make sure the decls get inserted into TUScope!
if (PP.getLangOptions().ObjC1) {
// Synthesize "typedef struct objc_class *Class;"
- RecordDecl *ClassTag = new RecordDecl(Decl::Struct, SourceLocation(),
- &IT.get("objc_class"), 0);
+ RecordDecl *ClassTag = RecordDecl::Create(Decl::Struct, SourceLocation(),
+ &IT.get("objc_class"), 0,Context);
QualType ClassT = Context.getPointerType(Context.getTagDeclType(ClassTag));
- TypedefDecl *ClassTypedef = new TypedefDecl(SourceLocation(),
- &Context.Idents.get("Class"),
- ClassT, 0);
+ TypedefDecl *ClassTypedef =
+ TypedefDecl::Create(SourceLocation(), &Context.Idents.get("Class"),
+ ClassT, 0, Context);
Context.setObjCClassType(ClassTypedef);
// Synthesize "@class Protocol;
@@ -110,15 +111,16 @@
Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl));
// Synthesize "typedef struct objc_object { Class isa; } *id;"
- RecordDecl *ObjectTag = new RecordDecl(Decl::Struct, SourceLocation(),
- &IT.get("objc_object"), 0);
+ RecordDecl *ObjectTag =
+ RecordDecl::Create(Decl::Struct, SourceLocation(), &IT.get("objc_object"),
+ 0, Context);
FieldDecl *IsaDecl = new FieldDecl(SourceLocation(), 0,
Context.getObjCClassType());
ObjectTag->defineBody(&IsaDecl, 1);
QualType ObjT = Context.getPointerType(Context.getTagDeclType(ObjectTag));
- TypedefDecl *IdTypedef = new TypedefDecl(SourceLocation(),
- &Context.Idents.get("id"),
- ObjT, 0);
+ TypedefDecl *IdTypedef = TypedefDecl::Create(SourceLocation(),
+ &Context.Idents.get("id"),
+ ObjT, 0, Context);
Context.setObjCIdType(IdTypedef);
}
TUScope = 0;