void PCHDeclWriter::VisitTypeDecl(TypeDecl *D) {
VisitNamedDecl(D);
- Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);
+ if (isa<CXXRecordDecl>(D)) {
+ // FIXME: Hack. To read a templated CXXRecordDecl from PCH, we need an
+ // initialized CXXRecordDecl before creating an InjectedClassNameType.
+ // Delay emitting/reading CXXRecordDecl's TypeForDecl until when we handle
+ // CXXRecordDecl emitting/initialization.
+ Writer.AddTypeRef(QualType(), Record);
+ } else
+ Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);
}
void PCHDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
Record.push_back(CXXRecNotTemplate);
}
+ // FIXME: Hack. See PCHDeclWriter::VisitTypeDecl.
+ Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);
+
if (D->isDefinition()) {
unsigned NumBases = D->getNumBases();
Record.push_back(NumBases);