[cfe-commits] r49530 - /cfe/trunk/lib/AST/DeclSerialization.cpp
Sam Bishop
sam at bishop.dhs.org
Fri Apr 11 07:49:10 PDT 2008
Author: sbishop
Date: Fri Apr 11 09:49:10 2008
New Revision: 49530
URL: http://llvm.org/viewvc/llvm-project?rev=49530&view=rev
Log:
Use the ASTContext allocator when creating deserialized Decl objects.
Modified:
cfe/trunk/lib/AST/DeclSerialization.cpp
Modified: cfe/trunk/lib/AST/DeclSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclSerialization.cpp?rev=49530&r1=49529&r2=49530&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/lib/AST/DeclSerialization.cpp Fri Apr 11 09:49:10 2008
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "llvm/Bitcode/Serialize.h"
@@ -198,8 +199,9 @@
//===----------------------------------------------------------------------===//
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);
@@ -211,8 +213,9 @@
//===----------------------------------------------------------------------===//
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);
@@ -230,8 +233,9 @@
}
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());
@@ -251,7 +255,8 @@
}
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());
@@ -282,9 +287,9 @@
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);
@@ -308,7 +313,8 @@
}
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);
@@ -343,8 +349,9 @@
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);
@@ -390,7 +397,8 @@
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());
@@ -426,7 +434,8 @@
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);
@@ -461,7 +470,8 @@
}
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));
More information about the cfe-commits
mailing list