forked from OSchip/llvm-project
Fix reading ClassTemplateDecl's ClassTemplateSpecializationDecls and ClassTemplatePartialSpecializationDecls.
Store/read also their template arguments because they may be initializing and not be able to provide them. llvm-svn: 107476
This commit is contained in:
parent
2c2167ac3d
commit
e23371e71d
|
@ -768,11 +768,12 @@ void PCHDeclReader::VisitClassTemplateDecl(ClassTemplateDecl *D) {
|
|||
while (size--) {
|
||||
ClassTemplateSpecializationDecl *CTSD
|
||||
= cast<ClassTemplateSpecializationDecl>(Reader.GetDecl(Record[Idx++]));
|
||||
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
||||
Reader.ReadTemplateArgumentList(TemplArgs, Record, Idx);
|
||||
llvm::FoldingSetNodeID ID;
|
||||
void *InsertPos = 0;
|
||||
ClassTemplateSpecializationDecl::Profile(ID,
|
||||
CTSD->getTemplateArgs().getFlatArgumentList(),
|
||||
CTSD->getTemplateArgs().flat_size(),
|
||||
ClassTemplateSpecializationDecl::Profile(ID, TemplArgs.data(),
|
||||
TemplArgs.size(),
|
||||
*Reader.getContext());
|
||||
D->getSpecializations().FindNodeOrInsertPos(ID, InsertPos);
|
||||
D->getSpecializations().InsertNode(CTSD, InsertPos);
|
||||
|
@ -783,12 +784,13 @@ void PCHDeclReader::VisitClassTemplateDecl(ClassTemplateDecl *D) {
|
|||
ClassTemplatePartialSpecializationDecl *CTSD
|
||||
= cast<ClassTemplatePartialSpecializationDecl>(
|
||||
Reader.GetDecl(Record[Idx++]));
|
||||
llvm::SmallVector<TemplateArgument, 8> TemplArgs;
|
||||
Reader.ReadTemplateArgumentList(TemplArgs, Record, Idx);
|
||||
llvm::FoldingSetNodeID ID;
|
||||
void *InsertPos = 0;
|
||||
ClassTemplatePartialSpecializationDecl::Profile(ID,
|
||||
CTSD->getTemplateArgs().getFlatArgumentList(),
|
||||
CTSD->getTemplateArgs().flat_size(),
|
||||
*Reader.getContext());
|
||||
ClassTemplatePartialSpecializationDecl::Profile(ID, TemplArgs.data(),
|
||||
TemplArgs.size(),
|
||||
*Reader.getContext());
|
||||
D->getPartialSpecializations().FindNodeOrInsertPos(ID, InsertPos);
|
||||
D->getPartialSpecializations().InsertNode(CTSD, InsertPos);
|
||||
}
|
||||
|
|
|
@ -751,14 +751,24 @@ void PCHDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
|
|||
typedef llvm::FoldingSet<ClassTemplateSpecializationDecl> CTSDSetTy;
|
||||
CTSDSetTy &CTSDSet = D->getSpecializations();
|
||||
Record.push_back(CTSDSet.size());
|
||||
for (CTSDSetTy::iterator I=CTSDSet.begin(), E = CTSDSet.end(); I!=E; ++I)
|
||||
Writer.AddDeclRef(&*I, Record);
|
||||
for (CTSDSetTy::iterator I=CTSDSet.begin(), E = CTSDSet.end(); I!=E; ++I) {
|
||||
ClassTemplateSpecializationDecl *CTSD = &*I;
|
||||
Writer.AddDeclRef(CTSD, Record);
|
||||
// Write the argument list here because we may get it uninitialized when
|
||||
// reading it back.
|
||||
Writer.AddTemplateArgumentList(&CTSD->getTemplateArgs(), Record);
|
||||
}
|
||||
|
||||
typedef llvm::FoldingSet<ClassTemplatePartialSpecializationDecl> CTPSDSetTy;
|
||||
CTPSDSetTy &CTPSDSet = D->getPartialSpecializations();
|
||||
Record.push_back(CTPSDSet.size());
|
||||
for (CTPSDSetTy::iterator I=CTPSDSet.begin(), E = CTPSDSet.end(); I!=E; ++I)
|
||||
Writer.AddDeclRef(&*I, Record);
|
||||
for (CTPSDSetTy::iterator I=CTPSDSet.begin(), E=CTPSDSet.end(); I!=E; ++I) {
|
||||
ClassTemplatePartialSpecializationDecl *CTPSD = &*I;
|
||||
Writer.AddDeclRef(CTPSD, Record);
|
||||
// Write the argument list here because we may get it uninitialized when
|
||||
// reading it back.
|
||||
Writer.AddTemplateArgumentList(&CTPSD->getTemplateArgs(), Record);
|
||||
}
|
||||
|
||||
// InjectedClassNameType is computed, no need to write it.
|
||||
|
||||
|
|
Loading…
Reference in New Issue