Pass the ASTContext object around when deserializing Decl and Stmt objects, so
they can be created using the same allocator as in the "from source code" case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49353 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index a2e9ce1..bc5310c 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -31,45 +31,45 @@
EmitImpl(S);
}
-Decl* Decl::Create(Deserializer& D) {
+Decl* Decl::Create(Deserializer& D, ASTContext& C) {
Kind k = static_cast<Kind>(D.ReadInt());
-
+
switch (k) {
default:
assert (false && "Not implemented.");
break;
case BlockVar:
- return BlockVarDecl::CreateImpl(D);
+ return BlockVarDecl::CreateImpl(D, C);
case Enum:
- return EnumDecl::CreateImpl(D);
+ return EnumDecl::CreateImpl(D, C);
case EnumConstant:
- return EnumConstantDecl::CreateImpl(D);
+ return EnumConstantDecl::CreateImpl(D, C);
case Field:
- return FieldDecl::CreateImpl(D);
+ return FieldDecl::CreateImpl(D, C);
case FileVar:
- return FileVarDecl::CreateImpl(D);
+ return FileVarDecl::CreateImpl(D, C);
case ParmVar:
- return ParmVarDecl::CreateImpl(D);
+ return ParmVarDecl::CreateImpl(D, C);
case Function:
- return FunctionDecl::CreateImpl(D);
+ return FunctionDecl::CreateImpl(D, C);
case Union:
case Struct:
- return RecordDecl::CreateImpl(k,D);
+ return RecordDecl::CreateImpl(k, D, C);
case Typedef:
- return TypedefDecl::CreateImpl(D);
+ return TypedefDecl::CreateImpl(D, C);
case FileScopeAsm:
- return FileScopeAsmDecl::CreateImpl(D);
+ return FileScopeAsmDecl::CreateImpl(D, C);
}
}
@@ -81,7 +81,7 @@
S.Emit(getLocation()); // From Decl.
}
-void Decl::ReadInRec(Deserializer& D) {
+void Decl::ReadInRec(Deserializer& D, ASTContext& C) {
Loc = SourceLocation::ReadVal(D); // From Decl.
}
@@ -94,8 +94,8 @@
S.EmitPtr(getIdentifier()); // From NamedDecl.
}
-void NamedDecl::ReadInRec(Deserializer& D) {
- Decl::ReadInRec(D);
+void NamedDecl::ReadInRec(Deserializer& D, ASTContext& C) {
+ Decl::ReadInRec(D, C);
D.ReadPtr(Identifier); // From NamedDecl.
}
@@ -109,8 +109,8 @@
S.EmitPtr(cast_or_null<Decl>(getDeclContext())); // From ScopedDecl.
}
-void ScopedDecl::ReadInRec(Deserializer& D) {
- NamedDecl::ReadInRec(D);
+void ScopedDecl::ReadInRec(Deserializer& D, ASTContext& C) {
+ NamedDecl::ReadInRec(D, C);
D.ReadPtr(Next); // From ScopedDecl.
Decl *TmpD;
D.ReadPtr(TmpD); // From ScopedDecl.
@@ -127,9 +127,9 @@
S.EmitOwnedPtr(getNextDeclarator()); // From ScopedDecl.
}
-void ScopedDecl::ReadOutRec(Deserializer& D) {
+void ScopedDecl::ReadOutRec(Deserializer& D, ASTContext& C) {
NextDeclarator =
- cast_or_null<ScopedDecl>(D.ReadOwnedPtr<Decl>()); // From ScopedDecl.
+ cast_or_null<ScopedDecl>(D.ReadOwnedPtr<Decl>(C)); // From ScopedDecl.
}
//===----------------------------------------------------------------------===//
@@ -141,8 +141,8 @@
S.Emit(getType()); // From ValueDecl.
}
-void ValueDecl::ReadInRec(Deserializer& D) {
- ScopedDecl::ReadInRec(D);
+void ValueDecl::ReadInRec(Deserializer& D, ASTContext& C) {
+ ScopedDecl::ReadInRec(D, C);
DeclType = QualType::ReadVal(D); // From ValueDecl.
}
@@ -155,8 +155,8 @@
S.EmitInt(getStorageClass()); // From VarDecl.
}
-void VarDecl::ReadInRec(Deserializer& D) {
- ValueDecl::ReadInRec(D);
+void VarDecl::ReadInRec(Deserializer& D, ASTContext& C) {
+ ValueDecl::ReadInRec(D, C);
SClass = static_cast<StorageClass>(D.ReadInt()); // From VarDecl.
}
@@ -172,11 +172,12 @@
getNextDeclarator()); // From ScopedDecl.
}
-void VarDecl::ReadOutRec(Deserializer& D) {
+void VarDecl::ReadOutRec(Deserializer& D, ASTContext& C) {
Decl* next_declarator;
- D.BatchReadOwnedPtrs(Init, // From VarDecl.
- next_declarator); // From ScopedDecl.
+ D.BatchReadOwnedPtrs(Init, // From VarDecl.
+ next_declarator, // From ScopedDecl.
+ C);
setNextDeclarator(cast_or_null<ScopedDecl>(next_declarator));
}
@@ -187,20 +188,20 @@
VarDecl::EmitOutRec(S);
}
-void VarDecl::ReadImpl(Deserializer& D) {
- ReadInRec(D);
- ReadOutRec(D);
+void VarDecl::ReadImpl(Deserializer& D, ASTContext& C) {
+ ReadInRec(D, C);
+ ReadOutRec(D, C);
}
//===----------------------------------------------------------------------===//
// BlockVarDecl Serialization.
//===----------------------------------------------------------------------===//
-BlockVarDecl* BlockVarDecl::CreateImpl(Deserializer& D) {
+BlockVarDecl* BlockVarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
BlockVarDecl* decl =
new BlockVarDecl(0, SourceLocation(),NULL,QualType(),None,NULL);
- decl->VarDecl::ReadImpl(D);
+ decl->VarDecl::ReadImpl(D, C);
return decl;
}
@@ -209,11 +210,11 @@
// FileVarDecl Serialization.
//===----------------------------------------------------------------------===//
-FileVarDecl* FileVarDecl::CreateImpl(Deserializer& D) {
+FileVarDecl* FileVarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
FileVarDecl* decl =
new FileVarDecl(0, SourceLocation(),NULL,QualType(),None,NULL);
- decl->VarDecl::ReadImpl(D);
+ decl->VarDecl::ReadImpl(D, C);
return decl;
}
@@ -227,11 +228,11 @@
S.EmitInt(getObjCDeclQualifier()); // From ParmVarDecl.
}
-ParmVarDecl* ParmVarDecl::CreateImpl(Deserializer& D) {
+ParmVarDecl* ParmVarDecl::CreateImpl(Deserializer& D, ASTContext& C) {
ParmVarDecl* decl =
new ParmVarDecl(0, SourceLocation(),NULL,QualType(),None,NULL);
- decl->VarDecl::ReadImpl(D);
+ decl->VarDecl::ReadImpl(D, C);
decl->objcDeclQualifier = static_cast<ObjCDeclQualifier>(D.ReadInt());
return decl;
@@ -248,17 +249,17 @@
S.BatchEmitOwnedPtrs(ElementList,getNextDeclarator());
}
-EnumDecl* EnumDecl::CreateImpl(Deserializer& D) {
+EnumDecl* EnumDecl::CreateImpl(Deserializer& D, ASTContext& C) {
EnumDecl* decl = new EnumDecl(0, SourceLocation(),NULL,NULL);
- decl->ScopedDecl::ReadInRec(D);
+ decl->ScopedDecl::ReadInRec(D, C);
decl->setDefinition(D.ReadBool());
decl->IntegerType = QualType::ReadVal(D);
Decl* next_declarator;
Decl* Elist;
- D.BatchReadOwnedPtrs(Elist,next_declarator);
+ D.BatchReadOwnedPtrs(Elist, next_declarator, C);
decl->ElementList = cast_or_null<EnumConstantDecl>(Elist);
decl->setNextDeclarator(cast_or_null<ScopedDecl>(next_declarator));
@@ -276,7 +277,7 @@
S.BatchEmitOwnedPtrs(getNextDeclarator(),Init);
}
-EnumConstantDecl* EnumConstantDecl::CreateImpl(Deserializer& D) {
+EnumConstantDecl* EnumConstantDecl::CreateImpl(Deserializer& D, ASTContext& C) {
llvm::APSInt val(1);
D.Read(val);
@@ -284,11 +285,11 @@
new EnumConstantDecl(0, SourceLocation(),NULL,QualType(),NULL,
val,NULL);
- decl->ValueDecl::ReadInRec(D);
+ decl->ValueDecl::ReadInRec(D, C);
Decl* next_declarator;
- D.BatchReadOwnedPtrs(next_declarator,decl->Init);
+ D.BatchReadOwnedPtrs(next_declarator, decl->Init, C);
decl->setNextDeclarator(cast_or_null<ScopedDecl>(next_declarator));
@@ -305,11 +306,11 @@
S.EmitOwnedPtr(BitWidth);
}
-FieldDecl* FieldDecl::CreateImpl(Deserializer& D) {
+FieldDecl* FieldDecl::CreateImpl(Deserializer& D, ASTContext& C) {
FieldDecl* decl = new FieldDecl(SourceLocation(), NULL, QualType(), 0);
decl->DeclType.ReadBackpatch(D);
- decl->ReadInRec(D);
- decl->BitWidth = D.ReadOwnedPtr<Expr>();
+ decl->ReadInRec(D, C);
+ decl->BitWidth = D.ReadOwnedPtr<Expr>(C);
return decl;
}
@@ -337,14 +338,14 @@
}
}
-FunctionDecl* FunctionDecl::CreateImpl(Deserializer& D) {
+FunctionDecl* FunctionDecl::CreateImpl(Deserializer& D, ASTContext& C) {
StorageClass SClass = static_cast<StorageClass>(D.ReadInt());
bool IsInline = D.ReadBool();
FunctionDecl* decl =
new FunctionDecl(0, SourceLocation(),NULL,QualType(),SClass, IsInline, 0);
- decl->ValueDecl::ReadInRec(D);
+ decl->ValueDecl::ReadInRec(D, C);
D.ReadPtr(decl->DeclChain);
Decl* next_declarator;
@@ -358,9 +359,9 @@
if (hasParamDecls)
D.BatchReadOwnedPtrs(decl->getNumParams(),
reinterpret_cast<Decl**>(&decl->ParamInfo[0]),
- decl->Body, next_declarator);
+ decl->Body, next_declarator, C);
else
- D.BatchReadOwnedPtrs(decl->Body, next_declarator);
+ D.BatchReadOwnedPtrs(decl->Body, next_declarator, C);
decl->setNextDeclarator(cast_or_null<ScopedDecl>(next_declarator));
@@ -385,10 +386,12 @@
ScopedDecl::EmitOutRec(S);
}
-RecordDecl* RecordDecl::CreateImpl(Decl::Kind DK, Deserializer& D) {
+RecordDecl* RecordDecl::CreateImpl(Decl::Kind DK, Deserializer& D,
+ ASTContext& C) {
+
RecordDecl* decl = new RecordDecl(DK,0,SourceLocation(),NULL,NULL);
- decl->ScopedDecl::ReadInRec(D);
+ decl->ScopedDecl::ReadInRec(D, C);
decl->setDefinition(D.ReadBool());
decl->setHasFlexibleArrayMember(D.ReadBool());
decl->NumMembers = D.ReadSInt();
@@ -399,12 +402,12 @@
D.BatchReadOwnedPtrs((unsigned) decl->getNumMembers(),
(Decl**) &decl->Members[0],
- next_declarator);
+ next_declarator, C);
decl->setNextDeclarator(cast_or_null<ScopedDecl>(next_declarator));
}
else
- decl->ScopedDecl::ReadOutRec(D);
+ decl->ScopedDecl::ReadOutRec(D, C);
return decl;
}
@@ -419,13 +422,13 @@
ScopedDecl::EmitOutRec(S);
}
-TypedefDecl* TypedefDecl::CreateImpl(Deserializer& D) {
+TypedefDecl* TypedefDecl::CreateImpl(Deserializer& D, ASTContext& C) {
QualType T = QualType::ReadVal(D);
TypedefDecl* decl = new TypedefDecl(0, SourceLocation(),NULL,T,NULL);
- decl->ScopedDecl::ReadInRec(D);
- decl->ScopedDecl::ReadOutRec(D);
+ decl->ScopedDecl::ReadInRec(D, C);
+ decl->ScopedDecl::ReadOutRec(D, C);
return decl;
}
@@ -440,8 +443,8 @@
S.EmitPtr(D);
}
-void LinkageSpecDecl::ReadInRec(Deserializer& D) {
- Decl::ReadInRec(D);
+void LinkageSpecDecl::ReadInRec(Deserializer& D, ASTContext& C) {
+ Decl::ReadInRec(D, C);
Language = static_cast<LanguageIDs>(D.ReadInt());
D.ReadPtr(this->D);
}
@@ -456,11 +459,11 @@
S.EmitOwnedPtr(AsmString);
}
-FileScopeAsmDecl* FileScopeAsmDecl::CreateImpl(Deserializer& D) {
+FileScopeAsmDecl* FileScopeAsmDecl::CreateImpl(Deserializer& D, ASTContext& C) {
FileScopeAsmDecl* decl = new FileScopeAsmDecl(SourceLocation(), 0);
- decl->Decl::ReadInRec(D);
- decl->AsmString = cast<StringLiteral>(D.ReadOwnedPtr<Expr>());
+ decl->Decl::ReadInRec(D, C);
+ decl->AsmString = cast<StringLiteral>(D.ReadOwnedPtr<Expr>(C));
// D.ReadOwnedPtr(D.ReadOwnedPtr<StringLiteral>())<#T * * Ptr#>, <#bool AutoRegister#>)(decl->AsmString);
return decl;
diff --git a/lib/AST/StmtSerialization.cpp b/lib/AST/StmtSerialization.cpp
index 433e8e2..41569df 100644
--- a/lib/AST/StmtSerialization.cpp
+++ b/lib/AST/StmtSerialization.cpp
@@ -27,7 +27,7 @@
S.FlushRecord();
}
-Stmt* Stmt::Create(Deserializer& D) {
+Stmt* Stmt::Create(Deserializer& D, ASTContext& C) {
StmtClass SC = static_cast<StmtClass>(D.ReadInt());
switch (SC) {
@@ -36,155 +36,155 @@
return NULL;
case AddrLabelExprClass:
- return AddrLabelExpr::CreateImpl(D);
+ return AddrLabelExpr::CreateImpl(D, C);
case ArraySubscriptExprClass:
- return ArraySubscriptExpr::CreateImpl(D);
+ return ArraySubscriptExpr::CreateImpl(D, C);
case AsmStmtClass:
- return AsmStmt::CreateImpl(D);
+ return AsmStmt::CreateImpl(D, C);
case BinaryOperatorClass:
- return BinaryOperator::CreateImpl(D);
+ return BinaryOperator::CreateImpl(D, C);
case BreakStmtClass:
- return BreakStmt::CreateImpl(D);
+ return BreakStmt::CreateImpl(D, C);
case CallExprClass:
- return CallExpr::CreateImpl(D);
+ return CallExpr::CreateImpl(D, C);
case CaseStmtClass:
- return CaseStmt::CreateImpl(D);
+ return CaseStmt::CreateImpl(D, C);
case CastExprClass:
- return CastExpr::CreateImpl(D);
+ return CastExpr::CreateImpl(D, C);
case CharacterLiteralClass:
- return CharacterLiteral::CreateImpl(D);
+ return CharacterLiteral::CreateImpl(D, C);
case CompoundAssignOperatorClass:
- return CompoundAssignOperator::CreateImpl(D);
+ return CompoundAssignOperator::CreateImpl(D, C);
case CompoundLiteralExprClass:
- return CompoundLiteralExpr::CreateImpl(D);
+ return CompoundLiteralExpr::CreateImpl(D, C);
case CompoundStmtClass:
- return CompoundStmt::CreateImpl(D);
+ return CompoundStmt::CreateImpl(D, C);
case ConditionalOperatorClass:
- return ConditionalOperator::CreateImpl(D);
+ return ConditionalOperator::CreateImpl(D, C);
case ContinueStmtClass:
- return ContinueStmt::CreateImpl(D);
+ return ContinueStmt::CreateImpl(D, C);
case DeclRefExprClass:
- return DeclRefExpr::CreateImpl(D);
+ return DeclRefExpr::CreateImpl(D, C);
case DeclStmtClass:
- return DeclStmt::CreateImpl(D);
+ return DeclStmt::CreateImpl(D, C);
case DefaultStmtClass:
- return DefaultStmt::CreateImpl(D);
+ return DefaultStmt::CreateImpl(D, C);
case DoStmtClass:
- return DoStmt::CreateImpl(D);
+ return DoStmt::CreateImpl(D, C);
case FloatingLiteralClass:
- return FloatingLiteral::CreateImpl(D);
+ return FloatingLiteral::CreateImpl(D, C);
case ForStmtClass:
- return ForStmt::CreateImpl(D);
+ return ForStmt::CreateImpl(D, C);
case GotoStmtClass:
- return GotoStmt::CreateImpl(D);
+ return GotoStmt::CreateImpl(D, C);
case IfStmtClass:
- return IfStmt::CreateImpl(D);
+ return IfStmt::CreateImpl(D, C);
case ImaginaryLiteralClass:
- return ImaginaryLiteral::CreateImpl(D);
+ return ImaginaryLiteral::CreateImpl(D, C);
case ImplicitCastExprClass:
- return ImplicitCastExpr::CreateImpl(D);
+ return ImplicitCastExpr::CreateImpl(D, C);
case IndirectGotoStmtClass:
- return IndirectGotoStmt::CreateImpl(D);
+ return IndirectGotoStmt::CreateImpl(D, C);
case InitListExprClass:
- return InitListExpr::CreateImpl(D);
+ return InitListExpr::CreateImpl(D, C);
case IntegerLiteralClass:
- return IntegerLiteral::CreateImpl(D);
+ return IntegerLiteral::CreateImpl(D, C);
case LabelStmtClass:
- return LabelStmt::CreateImpl(D);
+ return LabelStmt::CreateImpl(D, C);
case MemberExprClass:
- return MemberExpr::CreateImpl(D);
+ return MemberExpr::CreateImpl(D, C);
case NullStmtClass:
- return NullStmt::CreateImpl(D);
+ return NullStmt::CreateImpl(D, C);
case ParenExprClass:
- return ParenExpr::CreateImpl(D);
+ return ParenExpr::CreateImpl(D, C);
case PreDefinedExprClass:
- return PreDefinedExpr::CreateImpl(D);
+ return PreDefinedExpr::CreateImpl(D, C);
case ReturnStmtClass:
- return ReturnStmt::CreateImpl(D);
+ return ReturnStmt::CreateImpl(D, C);
case SizeOfAlignOfTypeExprClass:
- return SizeOfAlignOfTypeExpr::CreateImpl(D);
+ return SizeOfAlignOfTypeExpr::CreateImpl(D, C);
case StmtExprClass:
- return StmtExpr::CreateImpl(D);
+ return StmtExpr::CreateImpl(D, C);
case StringLiteralClass:
- return StringLiteral::CreateImpl(D);
+ return StringLiteral::CreateImpl(D, C);
case SwitchStmtClass:
- return SwitchStmt::CreateImpl(D);
+ return SwitchStmt::CreateImpl(D, C);
case UnaryOperatorClass:
- return UnaryOperator::CreateImpl(D);
+ return UnaryOperator::CreateImpl(D, C);
case WhileStmtClass:
- return WhileStmt::CreateImpl(D);
+ return WhileStmt::CreateImpl(D, C);
//==--------------------------------------==//
// Objective C
//==--------------------------------------==//
case ObjCAtCatchStmtClass:
- return ObjCAtCatchStmt::CreateImpl(D);
+ return ObjCAtCatchStmt::CreateImpl(D, C);
case ObjCAtFinallyStmtClass:
- return ObjCAtFinallyStmt::CreateImpl(D);
+ return ObjCAtFinallyStmt::CreateImpl(D, C);
case ObjCAtSynchronizedStmtClass:
- return ObjCAtSynchronizedStmt::CreateImpl(D);
+ return ObjCAtSynchronizedStmt::CreateImpl(D, C);
case ObjCAtThrowStmtClass:
- return ObjCAtThrowStmt::CreateImpl(D);
+ return ObjCAtThrowStmt::CreateImpl(D, C);
case ObjCAtTryStmtClass:
- return ObjCAtTryStmt::CreateImpl(D);
+ return ObjCAtTryStmt::CreateImpl(D, C);
case ObjCEncodeExprClass:
- return ObjCEncodeExpr::CreateImpl(D);
+ return ObjCEncodeExpr::CreateImpl(D, C);
case ObjCForCollectionStmtClass:
- return ObjCForCollectionStmt::CreateImpl(D);
+ return ObjCForCollectionStmt::CreateImpl(D, C);
case ObjCIvarRefExprClass:
- return ObjCIvarRefExpr::CreateImpl(D);
+ return ObjCIvarRefExpr::CreateImpl(D, C);
case ObjCSelectorExprClass:
- return ObjCSelectorExpr::CreateImpl(D);
+ return ObjCSelectorExpr::CreateImpl(D, C);
case ObjCStringLiteralClass:
- return ObjCStringLiteral::CreateImpl(D);
+ return ObjCStringLiteral::CreateImpl(D, C);
}
}
@@ -199,7 +199,7 @@
S.EmitPtr(Label);
}
-AddrLabelExpr* AddrLabelExpr::CreateImpl(Deserializer& D) {
+AddrLabelExpr* AddrLabelExpr::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
SourceLocation AALoc = SourceLocation::ReadVal(D);
SourceLocation LLoc = SourceLocation::ReadVal(D);
@@ -214,11 +214,11 @@
S.BatchEmitOwnedPtrs(getLHS(),getRHS());
}
-ArraySubscriptExpr* ArraySubscriptExpr::CreateImpl(Deserializer& D) {
+ArraySubscriptExpr* ArraySubscriptExpr::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
Expr *LHS, *RHS;
- D.BatchReadOwnedPtrs(LHS,RHS);
+ D.BatchReadOwnedPtrs(LHS, RHS, C);
return new ArraySubscriptExpr(LHS,RHS,t,L);
}
@@ -249,9 +249,9 @@
Clobbers[i]->EmitImpl(S);
}
-AsmStmt* AsmStmt::CreateImpl(Deserializer& D) {
+AsmStmt* AsmStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation ALoc = SourceLocation::ReadVal(D);
- StringLiteral *AsmStr = StringLiteral::CreateImpl(D);
+ StringLiteral *AsmStr = StringLiteral::CreateImpl(D, C);
SourceLocation PLoc = SourceLocation::ReadVal(D);
bool IsVolatile = D.ReadBool();
@@ -275,16 +275,16 @@
Stmt->Constraints.reserve(size);
for (unsigned i = 0; i < size; ++i)
- Stmt->Constraints.push_back(StringLiteral::CreateImpl(D));
+ Stmt->Constraints.push_back(StringLiteral::CreateImpl(D, C));
Stmt->Exprs.reserve(size);
for (unsigned i = 0; i < size; ++i)
- Stmt->Exprs.push_back(D.ReadOwnedPtr<Expr>());
+ Stmt->Exprs.push_back(D.ReadOwnedPtr<Expr>(C));
unsigned NumClobbers = D.ReadInt();
Stmt->Clobbers.reserve(NumClobbers);
for (unsigned i = 0; i < NumClobbers; ++i)
- Stmt->Clobbers.push_back(StringLiteral::CreateImpl(D));
+ Stmt->Clobbers.push_back(StringLiteral::CreateImpl(D, C));
return Stmt;
}
@@ -296,12 +296,12 @@
S.BatchEmitOwnedPtrs(getLHS(),getRHS());
}
-BinaryOperator* BinaryOperator::CreateImpl(Deserializer& D) {
+BinaryOperator* BinaryOperator::CreateImpl(Deserializer& D, ASTContext& C) {
Opcode Opc = static_cast<Opcode>(D.ReadInt());
SourceLocation OpLoc = SourceLocation::ReadVal(D);
QualType Result = QualType::ReadVal(D);
Expr *LHS, *RHS;
- D.BatchReadOwnedPtrs(LHS,RHS);
+ D.BatchReadOwnedPtrs(LHS, RHS, C);
return new BinaryOperator(LHS,RHS,Opc,Result,OpLoc);
}
@@ -310,7 +310,7 @@
S.Emit(BreakLoc);
}
-BreakStmt* BreakStmt::CreateImpl(Deserializer& D) {
+BreakStmt* BreakStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
return new BreakStmt(Loc);
}
@@ -322,12 +322,12 @@
S.BatchEmitOwnedPtrs(NumArgs+1,SubExprs);
}
-CallExpr* CallExpr::CreateImpl(Deserializer& D) {
+CallExpr* CallExpr::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
unsigned NumArgs = D.ReadInt();
Expr** SubExprs = new Expr*[NumArgs+1];
- D.BatchReadOwnedPtrs(NumArgs+1,SubExprs);
+ D.BatchReadOwnedPtrs(NumArgs+1, SubExprs, C);
return new CallExpr(SubExprs,NumArgs,t,L);
}
@@ -338,11 +338,11 @@
S.BatchEmitOwnedPtrs((unsigned) END_EXPR,&SubExprs[0]);
}
-CaseStmt* CaseStmt::CreateImpl(Deserializer& D) {
+CaseStmt* CaseStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation CaseLoc = SourceLocation::ReadVal(D);
CaseStmt* stmt = new CaseStmt(NULL,NULL,NULL,CaseLoc);
D.ReadPtr(stmt->NextSwitchCase);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR,&stmt->SubExprs[0]);
+ D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubExprs[0], C);
return stmt;
}
@@ -352,10 +352,10 @@
S.EmitOwnedPtr(Op);
}
-CastExpr* CastExpr::CreateImpl(Deserializer& D) {
+CastExpr* CastExpr::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
SourceLocation Loc = SourceLocation::ReadVal(D);
- Expr* Op = D.ReadOwnedPtr<Expr>();
+ Expr* Op = D.ReadOwnedPtr<Expr>(C);
return new CastExpr(t,Op,Loc);
}
@@ -366,7 +366,7 @@
S.Emit(getType());
}
-CharacterLiteral* CharacterLiteral::CreateImpl(Deserializer& D) {
+CharacterLiteral* CharacterLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
unsigned value = D.ReadInt();
SourceLocation Loc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
@@ -382,13 +382,13 @@
}
CompoundAssignOperator*
-CompoundAssignOperator::CreateImpl(Deserializer& D) {
+CompoundAssignOperator::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
QualType c = QualType::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
Opcode Opc = static_cast<Opcode>(D.ReadInt());
Expr* LHS, *RHS;
- D.BatchReadOwnedPtrs(LHS,RHS);
+ D.BatchReadOwnedPtrs(LHS, RHS, C);
return new CompoundAssignOperator(LHS,RHS,Opc,t,c,L);
}
@@ -400,11 +400,11 @@
S.EmitOwnedPtr(Init);
}
-CompoundLiteralExpr* CompoundLiteralExpr::CreateImpl(Deserializer& D) {
+CompoundLiteralExpr* CompoundLiteralExpr::CreateImpl(Deserializer& D, ASTContext& C) {
QualType Q = QualType::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
bool fileScope = D.ReadBool();
- Expr* Init = D.ReadOwnedPtr<Expr>();
+ Expr* Init = D.ReadOwnedPtr<Expr>(C);
return new CompoundLiteralExpr(L, Q, Init, fileScope);
}
@@ -417,7 +417,7 @@
S.EmitOwnedPtr(*I);
}
-CompoundStmt* CompoundStmt::CreateImpl(Deserializer& D) {
+CompoundStmt* CompoundStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation LB = SourceLocation::ReadVal(D);
SourceLocation RB = SourceLocation::ReadVal(D);
unsigned size = D.ReadInt();
@@ -427,7 +427,7 @@
stmt->Body.reserve(size);
for (unsigned i = 0; i < size; ++i)
- stmt->Body.push_back(D.ReadOwnedPtr<Stmt>());
+ stmt->Body.push_back(D.ReadOwnedPtr<Stmt>(C));
return stmt;
}
@@ -437,10 +437,12 @@
S.BatchEmitOwnedPtrs((unsigned) END_EXPR, SubExprs);
}
-ConditionalOperator* ConditionalOperator::CreateImpl(Deserializer& D) {
+ConditionalOperator* ConditionalOperator::CreateImpl(Deserializer& D,
+ ASTContext& C) {
+
QualType t = QualType::ReadVal(D);
ConditionalOperator* c = new ConditionalOperator(NULL,NULL,NULL,t);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, c->SubExprs);
+ D.BatchReadOwnedPtrs((unsigned) END_EXPR, c->SubExprs, C);
return c;
}
@@ -448,7 +450,7 @@
S.Emit(ContinueLoc);
}
-ContinueStmt* ContinueStmt::CreateImpl(Deserializer& D) {
+ContinueStmt* ContinueStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
return new ContinueStmt(Loc);
}
@@ -490,7 +492,7 @@
}
}
-DeclRefExpr* DeclRefExpr::CreateImpl(Deserializer& D) {
+DeclRefExpr* DeclRefExpr::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
bool OwnsDecl = D.ReadBool();
@@ -499,14 +501,13 @@
if (!OwnsDecl)
D.ReadPtr(decl,false); // No backpatching.
else
- decl = cast<ValueDecl>(D.ReadOwnedPtr<Decl>());
+ decl = cast<ValueDecl>(D.ReadOwnedPtr<Decl>(C));
return new DeclRefExpr(decl,T,Loc);
}
-
-DeclStmt* DeclStmt::CreateImpl(Deserializer& D) {
- ScopedDecl* decl = cast<ScopedDecl>(D.ReadOwnedPtr<Decl>());
+DeclStmt* DeclStmt::CreateImpl(Deserializer& D, ASTContext& C) {
+ ScopedDecl* decl = cast<ScopedDecl>(D.ReadOwnedPtr<Decl>(C));
SourceLocation StartLoc = SourceLocation::ReadVal(D);
SourceLocation EndLoc = SourceLocation::ReadVal(D);
return new DeclStmt(decl, StartLoc, EndLoc);
@@ -518,9 +519,9 @@
S.EmitPtr(getNextSwitchCase());
}
-DefaultStmt* DefaultStmt::CreateImpl(Deserializer& D) {
+DefaultStmt* DefaultStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
- Stmt* SubStmt = D.ReadOwnedPtr<Stmt>();
+ Stmt* SubStmt = D.ReadOwnedPtr<Stmt>(C);
DefaultStmt* stmt = new DefaultStmt(Loc,SubStmt);
stmt->setNextSwitchCase(D.ReadPtr<SwitchCase>());
@@ -534,10 +535,10 @@
S.EmitOwnedPtr(getBody());
}
-DoStmt* DoStmt::CreateImpl(Deserializer& D) {
+DoStmt* DoStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation DoLoc = SourceLocation::ReadVal(D);
- Expr* Cond = D.ReadOwnedPtr<Expr>();
- Stmt* Body = D.ReadOwnedPtr<Stmt>();
+ Expr* Cond = D.ReadOwnedPtr<Expr>(C);
+ Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
return new DoStmt(Body,Cond,DoLoc);
}
@@ -548,7 +549,7 @@
S.Emit(Value);
}
-FloatingLiteral* FloatingLiteral::CreateImpl(Deserializer& D) {
+FloatingLiteral* FloatingLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
QualType t = QualType::ReadVal(D);
bool isExact = D.ReadBool();
@@ -565,12 +566,12 @@
S.EmitOwnedPtr(getBody());
}
-ForStmt* ForStmt::CreateImpl(Deserializer& D) {
+ForStmt* ForStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation ForLoc = SourceLocation::ReadVal(D);
- Stmt* Init = D.ReadOwnedPtr<Stmt>();
- Expr* Cond = D.ReadOwnedPtr<Expr>();
- Expr* Inc = D.ReadOwnedPtr<Expr>();
- Stmt* Body = D.ReadOwnedPtr<Stmt>();
+ Stmt* Init = D.ReadOwnedPtr<Stmt>(C);
+ Expr* Cond = D.ReadOwnedPtr<Expr>(C);
+ Expr* Inc = D.ReadOwnedPtr<Expr>(C);
+ Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
return new ForStmt(Init,Cond,Inc,Body,ForLoc);
}
@@ -580,7 +581,7 @@
S.EmitPtr(Label);
}
-GotoStmt* GotoStmt::CreateImpl(Deserializer& D) {
+GotoStmt* GotoStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation GotoLoc = SourceLocation::ReadVal(D);
SourceLocation LabelLoc = SourceLocation::ReadVal(D);
GotoStmt* stmt = new GotoStmt(NULL,GotoLoc,LabelLoc);
@@ -595,11 +596,11 @@
S.EmitOwnedPtr(getElse());
}
-IfStmt* IfStmt::CreateImpl(Deserializer& D) {
+IfStmt* IfStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation L = SourceLocation::ReadVal(D);
- Expr* Cond = D.ReadOwnedPtr<Expr>();
- Stmt* Then = D.ReadOwnedPtr<Stmt>();
- Stmt* Else = D.ReadOwnedPtr<Stmt>();
+ Expr* Cond = D.ReadOwnedPtr<Expr>(C);
+ Stmt* Then = D.ReadOwnedPtr<Stmt>(C);
+ Stmt* Else = D.ReadOwnedPtr<Stmt>(C);
return new IfStmt(L,Cond,Then,Else);
}
@@ -608,9 +609,9 @@
S.EmitOwnedPtr(Val);
}
-ImaginaryLiteral* ImaginaryLiteral::CreateImpl(Deserializer& D) {
+ImaginaryLiteral* ImaginaryLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
- Expr* expr = D.ReadOwnedPtr<Expr>();
+ Expr* expr = D.ReadOwnedPtr<Expr>(C);
assert (isa<FloatingLiteral>(expr) || isa<IntegerLiteral>(expr));
return new ImaginaryLiteral(expr,t);
}
@@ -620,9 +621,9 @@
S.EmitOwnedPtr(Op);
}
-ImplicitCastExpr* ImplicitCastExpr::CreateImpl(Deserializer& D) {
+ImplicitCastExpr* ImplicitCastExpr::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
- Expr* Op = D.ReadOwnedPtr<Expr>();
+ Expr* Op = D.ReadOwnedPtr<Expr>(C);
return new ImplicitCastExpr(t,Op);
}
@@ -630,8 +631,8 @@
S.EmitOwnedPtr(Target);
}
-IndirectGotoStmt* IndirectGotoStmt::CreateImpl(Deserializer& D) {
- Expr* Target = D.ReadOwnedPtr<Expr>();
+IndirectGotoStmt* IndirectGotoStmt::CreateImpl(Deserializer& D, ASTContext& C) {
+ Expr* Target = D.ReadOwnedPtr<Expr>(C);
return new IndirectGotoStmt(Target);
}
@@ -642,14 +643,14 @@
S.BatchEmitOwnedPtrs(NumInits,InitExprs);
}
-InitListExpr* InitListExpr::CreateImpl(Deserializer& D) {
+InitListExpr* InitListExpr::CreateImpl(Deserializer& D, ASTContext& C) {
InitListExpr* expr = new InitListExpr();
expr->LBraceLoc = SourceLocation::ReadVal(D);
expr->RBraceLoc = SourceLocation::ReadVal(D);
expr->NumInits = D.ReadInt();
assert(expr->NumInits);
expr->InitExprs = new Expr*[expr->NumInits];
- D.BatchReadOwnedPtrs(expr->NumInits,expr->InitExprs);
+ D.BatchReadOwnedPtrs(expr->NumInits, expr->InitExprs, C);
return expr;
}
@@ -659,7 +660,7 @@
S.Emit(getValue());
}
-IntegerLiteral* IntegerLiteral::CreateImpl(Deserializer& D) {
+IntegerLiteral* IntegerLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
@@ -678,10 +679,10 @@
S.EmitOwnedPtr(SubStmt);
}
-LabelStmt* LabelStmt::CreateImpl(Deserializer& D) {
+LabelStmt* LabelStmt::CreateImpl(Deserializer& D, ASTContext& C) {
IdentifierInfo* Label = D.ReadPtr<IdentifierInfo>();
SourceLocation IdentLoc = SourceLocation::ReadVal(D);
- Stmt* SubStmt = D.ReadOwnedPtr<Stmt>();
+ Stmt* SubStmt = D.ReadOwnedPtr<Stmt>(C);
return new LabelStmt(IdentLoc,Label,SubStmt);
}
@@ -693,12 +694,12 @@
S.EmitOwnedPtr(Base);
}
-MemberExpr* MemberExpr::CreateImpl(Deserializer& D) {
+MemberExpr* MemberExpr::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation L = SourceLocation::ReadVal(D);
FieldDecl* MemberDecl = cast<FieldDecl>(D.ReadPtr<Decl>());
bool IsArrow = D.ReadBool();
QualType T = QualType::ReadVal(D);
- Expr* base = D.ReadOwnedPtr<Expr>();
+ Expr* base = D.ReadOwnedPtr<Expr>(C);
return new MemberExpr(base,IsArrow,MemberDecl,L,T);
}
@@ -707,7 +708,7 @@
S.Emit(SemiLoc);
}
-NullStmt* NullStmt::CreateImpl(Deserializer& D) {
+NullStmt* NullStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation SemiLoc = SourceLocation::ReadVal(D);
return new NullStmt(SemiLoc);
}
@@ -718,10 +719,10 @@
S.EmitOwnedPtr(Val);
}
-ParenExpr* ParenExpr::CreateImpl(Deserializer& D) {
+ParenExpr* ParenExpr::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation L = SourceLocation::ReadVal(D);
SourceLocation R = SourceLocation::ReadVal(D);
- Expr* val = D.ReadOwnedPtr<Expr>();
+ Expr* val = D.ReadOwnedPtr<Expr>(C);
return new ParenExpr(L,R,val);
}
@@ -731,7 +732,7 @@
S.Emit(getType());
}
-PreDefinedExpr* PreDefinedExpr::CreateImpl(Deserializer& D) {
+PreDefinedExpr* PreDefinedExpr::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
IdentType it = static_cast<IdentType>(D.ReadInt());
QualType Q = QualType::ReadVal(D);
@@ -743,9 +744,9 @@
S.EmitOwnedPtr(RetExpr);
}
-ReturnStmt* ReturnStmt::CreateImpl(Deserializer& D) {
+ReturnStmt* ReturnStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation RetLoc = SourceLocation::ReadVal(D);
- Expr* RetExpr = D.ReadOwnedPtr<Expr>();
+ Expr* RetExpr = D.ReadOwnedPtr<Expr>(C);
return new ReturnStmt(RetLoc,RetExpr);
}
@@ -757,7 +758,7 @@
S.Emit(RParenLoc);
}
-SizeOfAlignOfTypeExpr* SizeOfAlignOfTypeExpr::CreateImpl(Deserializer& D) {
+SizeOfAlignOfTypeExpr* SizeOfAlignOfTypeExpr::CreateImpl(Deserializer& D, ASTContext& C) {
bool isSizeof = D.ReadBool();
QualType Ty = QualType::ReadVal(D);
QualType Res = QualType::ReadVal(D);
@@ -774,11 +775,11 @@
S.EmitOwnedPtr(SubStmt);
}
-StmtExpr* StmtExpr::CreateImpl(Deserializer& D) {
+StmtExpr* StmtExpr::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
SourceLocation R = SourceLocation::ReadVal(D);
- CompoundStmt* SubStmt = cast<CompoundStmt>(D.ReadOwnedPtr<Stmt>());
+ CompoundStmt* SubStmt = cast<CompoundStmt>(D.ReadOwnedPtr<Stmt>(C));
return new StmtExpr(SubStmt,t,L,R);
}
@@ -793,7 +794,7 @@
S.EmitInt(StrData[i]);
}
-StringLiteral* StringLiteral::CreateImpl(Deserializer& D) {
+StringLiteral* StringLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
SourceLocation firstTokLoc = SourceLocation::ReadVal(D);
SourceLocation lastTokLoc = SourceLocation::ReadVal(D);
@@ -819,10 +820,10 @@
S.EmitPtr(FirstCase);
}
-SwitchStmt* SwitchStmt::CreateImpl(Deserializer& D) {
+SwitchStmt* SwitchStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
- Stmt* Cond = D.ReadOwnedPtr<Stmt>();
- Stmt* Body = D.ReadOwnedPtr<Stmt>();
+ Stmt* Cond = D.ReadOwnedPtr<Stmt>(C);
+ Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
SwitchCase* FirstCase = cast<SwitchCase>(D.ReadPtr<Stmt>());
SwitchStmt* stmt = new SwitchStmt(cast<Expr>(Cond));
@@ -839,11 +840,11 @@
S.EmitOwnedPtr(Val);
}
-UnaryOperator* UnaryOperator::CreateImpl(Deserializer& D) {
+UnaryOperator* UnaryOperator::CreateImpl(Deserializer& D, ASTContext& C) {
QualType t = QualType::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
Opcode Opc = static_cast<Opcode>(D.ReadInt());
- Expr* Val = D.ReadOwnedPtr<Expr>();
+ Expr* Val = D.ReadOwnedPtr<Expr>(C);
return new UnaryOperator(Val,Opc,t,L);
}
@@ -853,10 +854,10 @@
S.EmitOwnedPtr(getBody());
}
-WhileStmt* WhileStmt::CreateImpl(Deserializer& D) {
+WhileStmt* WhileStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation WhileLoc = SourceLocation::ReadVal(D);
- Expr* Cond = D.ReadOwnedPtr<Expr>();
- Stmt* Body = D.ReadOwnedPtr<Stmt>();
+ Expr* Cond = D.ReadOwnedPtr<Expr>(C);
+ Stmt* Body = D.ReadOwnedPtr<Stmt>(C);
return new WhileStmt(Cond,Body,WhileLoc);
}
@@ -870,12 +871,12 @@
S.BatchEmitOwnedPtrs((unsigned) END_EXPR, &SubExprs[0]);
}
-ObjCAtCatchStmt* ObjCAtCatchStmt::CreateImpl(Deserializer& D) {
+ObjCAtCatchStmt* ObjCAtCatchStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation AtCatchLoc = SourceLocation::ReadVal(D);
SourceLocation RParenLoc = SourceLocation::ReadVal(D);
ObjCAtCatchStmt* stmt = new ObjCAtCatchStmt(AtCatchLoc,RParenLoc);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubExprs[0]);
+ D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubExprs[0], C);
return stmt;
}
@@ -885,9 +886,9 @@
S.EmitOwnedPtr(AtFinallyStmt);
}
-ObjCAtFinallyStmt* ObjCAtFinallyStmt::CreateImpl(Deserializer& D) {
+ObjCAtFinallyStmt* ObjCAtFinallyStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
- Stmt* AtFinallyStmt = D.ReadOwnedPtr<Stmt>();
+ Stmt* AtFinallyStmt = D.ReadOwnedPtr<Stmt>(C);
return new ObjCAtFinallyStmt(Loc,AtFinallyStmt);
}
@@ -896,10 +897,12 @@
S.BatchEmitOwnedPtrs((unsigned) END_EXPR,&SubStmts[0]);
}
-ObjCAtSynchronizedStmt* ObjCAtSynchronizedStmt::CreateImpl(Deserializer& D) {
+ObjCAtSynchronizedStmt* ObjCAtSynchronizedStmt::CreateImpl(Deserializer& D,
+ ASTContext& C) {
+
SourceLocation L = SourceLocation::ReadVal(D);
ObjCAtSynchronizedStmt* stmt = new ObjCAtSynchronizedStmt(L,0,0);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubStmts[0]);
+ D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubStmts[0], C);
return stmt;
}
@@ -908,9 +911,9 @@
S.EmitOwnedPtr(Throw);
}
-ObjCAtThrowStmt* ObjCAtThrowStmt::CreateImpl(Deserializer& D) {
+ObjCAtThrowStmt* ObjCAtThrowStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation L = SourceLocation::ReadVal(D);
- Stmt* Throw = D.ReadOwnedPtr<Stmt>();
+ Stmt* Throw = D.ReadOwnedPtr<Stmt>(C);
return new ObjCAtThrowStmt(L,Throw);
}
@@ -919,10 +922,10 @@
S.BatchEmitOwnedPtrs((unsigned) END_EXPR, &SubStmts[0]);
}
-ObjCAtTryStmt* ObjCAtTryStmt::CreateImpl(Deserializer& D) {
+ObjCAtTryStmt* ObjCAtTryStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation L = SourceLocation::ReadVal(D);
ObjCAtTryStmt* stmt = new ObjCAtTryStmt(L,NULL,NULL,NULL);
- D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubStmts[0]);
+ D.BatchReadOwnedPtrs((unsigned) END_EXPR, &stmt->SubStmts[0], C);
return stmt;
}
@@ -933,7 +936,7 @@
S.Emit(EncType);
}
-ObjCEncodeExpr* ObjCEncodeExpr::CreateImpl(Deserializer& D) {
+ObjCEncodeExpr* ObjCEncodeExpr::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation AtLoc = SourceLocation::ReadVal(D);
SourceLocation RParenLoc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
@@ -947,13 +950,13 @@
S.BatchEmitOwnedPtrs(getElement(),getCollection(),getBody());
}
-ObjCForCollectionStmt* ObjCForCollectionStmt::CreateImpl(Deserializer& D) {
+ObjCForCollectionStmt* ObjCForCollectionStmt::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation ForLoc = SourceLocation::ReadVal(D);
SourceLocation RParenLoc = SourceLocation::ReadVal(D);
Stmt* Element;
Expr* Collection;
Stmt* Body;
- D.BatchReadOwnedPtrs(Element,Collection,Body);
+ D.BatchReadOwnedPtrs(Element, Collection, Body, C);
return new ObjCForCollectionStmt(Element,Collection,Body,ForLoc, RParenLoc);
}
@@ -963,7 +966,7 @@
S.EmitPtr(getDecl());
}
-ObjCIvarRefExpr* ObjCIvarRefExpr::CreateImpl(Deserializer& D) {
+ObjCIvarRefExpr* ObjCIvarRefExpr::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation Loc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
ObjCIvarRefExpr* dr = new ObjCIvarRefExpr(NULL,T,Loc);
@@ -978,7 +981,7 @@
S.Emit(SelName);
}
-ObjCSelectorExpr* ObjCSelectorExpr::CreateImpl(Deserializer& D) {
+ObjCSelectorExpr* ObjCSelectorExpr::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation AtLoc = SourceLocation::ReadVal(D);
SourceLocation RParenLoc = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
@@ -993,9 +996,9 @@
S.EmitOwnedPtr(String);
}
-ObjCStringLiteral* ObjCStringLiteral::CreateImpl(Deserializer& D) {
+ObjCStringLiteral* ObjCStringLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
SourceLocation L = SourceLocation::ReadVal(D);
QualType T = QualType::ReadVal(D);
- StringLiteral* String = cast<StringLiteral>(D.ReadOwnedPtr<Stmt>());
+ StringLiteral* String = cast<StringLiteral>(D.ReadOwnedPtr<Stmt>(C));
return new ObjCStringLiteral(String,T,L);
}
diff --git a/lib/AST/TranslationUnit.cpp b/lib/AST/TranslationUnit.cpp
index 3ad134a..b3a2e68 100644
--- a/lib/AST/TranslationUnit.cpp
+++ b/lib/AST/TranslationUnit.cpp
@@ -221,7 +221,7 @@
llvm::Deserializer::Location DeclBlockLoc = Dezr.getCurrentBlockLocation();
while (!Dezr.FinishedBlock(DeclBlockLoc))
- TU->AddTopLevelDecl(Dezr.ReadOwnedPtr<Decl>());
+ TU->AddTopLevelDecl(Dezr.ReadOwnedPtr<Decl>(*TU->Context));
return TU;
}
diff --git a/lib/AST/TypeSerialization.cpp b/lib/AST/TypeSerialization.cpp
index 55c0a48..ff86d82 100644
--- a/lib/AST/TypeSerialization.cpp
+++ b/lib/AST/TypeSerialization.cpp
@@ -229,7 +229,7 @@
Types.push_back(T);
// Deserialize the decl.
- T->decl = cast<TagDecl>(D.ReadOwnedPtr<Decl>());
+ T->decl = cast<TagDecl>(D.ReadOwnedPtr<Decl>(Context));
return T;
}
@@ -269,7 +269,7 @@
QualType ElTy = QualType::ReadVal(D);
ArraySizeModifier am = static_cast<ArraySizeModifier>(D.ReadInt());
unsigned ITQ = D.ReadInt();
- Expr* SizeExpr = D.ReadOwnedPtr<Expr>();
+ Expr* SizeExpr = D.ReadOwnedPtr<Expr>(Context);
return Context.getVariableArrayType(ElTy,SizeExpr,am,ITQ).getTypePtr();
}