switch the rest of the C decl classes to do their
allocation through ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48403 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index db4d53a..902f422 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1064,7 +1064,8 @@
FieldDecl *FieldDecls[4];
for (unsigned i = 0; i < 4; ++i)
- FieldDecls[i] = new FieldDecl(SourceLocation(), 0, FieldTypes[i]);
+ FieldDecls[i] = FieldDecl::Create(*this, SourceLocation(), 0,
+ FieldTypes[i]);
CFConstantStringTypeDecl->defineBody(FieldDecls, 4);
}
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 7fa679c..4ce6fa8 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -235,6 +235,12 @@
return new (Mem) FunctionDecl(L, Id, T, S, isInline, PrevDecl);
}
+FieldDecl *FieldDecl::Create(ASTContext &C, SourceLocation L,
+ IdentifierInfo *Id, QualType T, Expr *BW) {
+ void *Mem = C.getAllocator().Allocate<FieldDecl>();
+ return new (Mem) FieldDecl(L, Id, T, BW);
+}
+
EnumConstantDecl *EnumConstantDecl::Create(ASTContext &C, SourceLocation L,
IdentifierInfo *Id, QualType T,
@@ -263,6 +269,17 @@
return new (Mem) RecordDecl(DK, L, Id, PrevDecl);
}
+FileScopeAsmDecl *FileScopeAsmDecl::Create(ASTContext &C, SourceLocation L,
+ StringLiteral *Str) {
+ void *Mem = C.getAllocator().Allocate<FileScopeAsmDecl>();
+ return new (Mem) FileScopeAsmDecl(L, Str);
+}
+
+LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C, SourceLocation L,
+ LanguageIDs Lang, Decl *D) {
+ void *Mem = C.getAllocator().Allocate<LinkageSpecDecl>();
+ return new (Mem) LinkageSpecDecl(L, Lang, D);
+}
//===----------------------------------------------------------------------===//
// Decl Implementation
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index a7eaed5..fe2ccef 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -302,7 +302,7 @@
}
FieldDecl* FieldDecl::CreateImpl(Deserializer& D) {
- FieldDecl* decl = new FieldDecl(SourceLocation(),NULL,QualType());
+ FieldDecl* decl = new FieldDecl(SourceLocation(), NULL, QualType(), 0);
decl->DeclType.ReadBackpatch(D);
decl->ReadInRec(D);
decl->BitWidth = D.ReadOwnedPtr<Expr>();