//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "llvm/Bitcode/Serialize.h"
//===----------------------------------------------------------------------===//
BlockVarDecl* BlockVarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
- BlockVarDecl* decl =
- new BlockVarDecl(0, SourceLocation(),NULL,QualType(),None,NULL);
+ void *Mem = C.getAllocator().Allocate<BlockVarDecl>();
+ BlockVarDecl* decl =
+ new (Mem) BlockVarDecl(0, SourceLocation(), NULL, QualType(), None, NULL);
decl->VarDecl::ReadImpl(D, C);
//===----------------------------------------------------------------------===//
FileVarDecl* FileVarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
+ void *Mem = C.getAllocator().Allocate<FileVarDecl>();
FileVarDecl* decl =
- new FileVarDecl(0, SourceLocation(),NULL,QualType(),None,NULL);
+ new (Mem) FileVarDecl(0, SourceLocation(), NULL, QualType(), None, NULL);
decl->VarDecl::ReadImpl(D, C);
}
ParmVarDecl* ParmVarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
- ParmVarDecl* decl =
- new ParmVarDecl(0, SourceLocation(), NULL, QualType(), None, NULL, NULL);
+ void *Mem = C.getAllocator().Allocate<ParmVarDecl>();
+ ParmVarDecl* decl = new (Mem)
+ ParmVarDecl(0, SourceLocation(), NULL, QualType(), None, NULL, NULL);
decl->VarDecl::ReadImpl(D, C);
decl->objcDeclQualifier = static_cast<ObjCDeclQualifier>(D.ReadInt());
}
EnumDecl* EnumDecl::CreateImpl(Deserializer& D, ASTContext& C) {
- EnumDecl* decl = new EnumDecl(0, SourceLocation(),NULL,NULL);
+ void *Mem = C.getAllocator().Allocate<EnumDecl>();
+ EnumDecl* decl = new (Mem) EnumDecl(0, SourceLocation(), NULL, NULL);
decl->ScopedDecl::ReadInRec(D, C);
decl->setDefinition(D.ReadBool());
llvm::APSInt val(1);
D.Read(val);
- EnumConstantDecl* decl =
- new EnumConstantDecl(0, SourceLocation(),NULL,QualType(),NULL,
- val,NULL);
+ void *Mem = C.getAllocator().Allocate<EnumConstantDecl>();
+ EnumConstantDecl* decl = new (Mem)
+ EnumConstantDecl(0, SourceLocation(), NULL, QualType(), NULL, val, NULL);
decl->ValueDecl::ReadInRec(D, C);
}
FieldDecl* FieldDecl::CreateImpl(Deserializer& D, ASTContext& C) {
- FieldDecl* decl = new FieldDecl(SourceLocation(), NULL, QualType(), 0);
+ void *Mem = C.getAllocator().Allocate<FieldDecl>();
+ FieldDecl* decl = new (Mem) FieldDecl(SourceLocation(), NULL, QualType(), 0);
decl->DeclType.ReadBackpatch(D);
decl->ReadInRec(D, C);
decl->BitWidth = D.ReadOwnedPtr<Expr>(C);
StorageClass SClass = static_cast<StorageClass>(D.ReadInt());
bool IsInline = D.ReadBool();
- FunctionDecl* decl =
- new FunctionDecl(0, SourceLocation(),NULL,QualType(),SClass, IsInline, 0);
+ void *Mem = C.getAllocator().Allocate<FunctionDecl>();
+ FunctionDecl* decl = new (Mem)
+ FunctionDecl(0, SourceLocation(), NULL, QualType(), SClass, IsInline, 0);
decl->ValueDecl::ReadInRec(D, C);
D.ReadPtr(decl->DeclChain);
RecordDecl* RecordDecl::CreateImpl(Decl::Kind DK, Deserializer& D,
ASTContext& C) {
- RecordDecl* decl = new RecordDecl(DK,0,SourceLocation(),NULL,NULL);
+ void *Mem = C.getAllocator().Allocate<RecordDecl>();
+ RecordDecl* decl = new (Mem) RecordDecl(DK, 0, SourceLocation(), NULL, NULL);
decl->ScopedDecl::ReadInRec(D, C);
decl->setDefinition(D.ReadBool());
TypedefDecl* TypedefDecl::CreateImpl(Deserializer& D, ASTContext& C) {
QualType T = QualType::ReadVal(D);
- TypedefDecl* decl = new TypedefDecl(0, SourceLocation(),NULL,T,NULL);
+ void *Mem = C.getAllocator().Allocate<TypedefDecl>();
+ TypedefDecl* decl = new (Mem) TypedefDecl(0, SourceLocation(), NULL, T, NULL);
decl->ScopedDecl::ReadInRec(D, C);
decl->ScopedDecl::ReadOutRec(D, C);
}
FileScopeAsmDecl* FileScopeAsmDecl::CreateImpl(Deserializer& D, ASTContext& C) {
- FileScopeAsmDecl* decl = new FileScopeAsmDecl(SourceLocation(), 0);
+ void *Mem = C.getAllocator().Allocate<FileScopeAsmDecl>();
+ FileScopeAsmDecl* decl = new (Mem) FileScopeAsmDecl(SourceLocation(), 0);
decl->Decl::ReadInRec(D, C);
decl->AsmString = cast<StringLiteral>(D.ReadOwnedPtr<Expr>(C));