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/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 300a382..90f9133 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1175,8 +1175,9 @@
assert(!T.isNull() && "GetTypeForDeclarator() returned null type");
// Scope manipulation handled by caller.
- TypedefDecl *NewTD = new TypedefDecl(D.getIdentifierLoc(), D.getIdentifier(),
- T, LastDeclarator);
+ TypedefDecl *NewTD = TypedefDecl::Create(D.getIdentifierLoc(),
+ D.getIdentifier(),
+ T, LastDeclarator, Context);
if (D.getInvalidType())
NewTD->setInvalidDecl();
return NewTD;
@@ -1255,7 +1256,7 @@
case Decl::Enum:
// FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.:
// enum X { A, B, C } D; D should chain to X.
- New = new EnumDecl(Loc, Name, 0);
+ New = EnumDecl::Create(Loc, Name, 0, Context);
// If this is an undefined enum, warn.
if (TK != TK_Definition) Diag(Loc, diag::ext_forward_ref_enum);
break;
@@ -1264,7 +1265,7 @@
case Decl::Class:
// FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.:
// struct X { int A; } D; D should chain to X.
- New = new RecordDecl(Kind, Loc, Name, 0);
+ New = RecordDecl::Create(Kind, Loc, Name, 0, Context);
break;
}
@@ -1577,8 +1578,9 @@
}
}
- EnumConstantDecl *New = new EnumConstantDecl(IdLoc, Id, EltTy, Val, EnumVal,
- LastEnumConst);
+ EnumConstantDecl *New =
+ EnumConstantDecl::Create(IdLoc, Id, EltTy, Val, EnumVal, LastEnumConst,
+ Context);
// Register this decl in the current scope stack.
New->setNext(Id->getFETokenInfo<ScopedDecl>());