diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Frontend/PCHReaderDecl.cpp | 3 | ||||
-rw-r--r-- | lib/Frontend/PCHWriterDecl.cpp | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index fe11ca76d3..3fc159ace2 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -590,6 +590,9 @@ void PCHDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) { } } + // FIXME: Hack. See PCHDeclWriter::VisitTypeDecl. + D->setTypeForDecl(Reader.GetType(Record[Idx++]).getTypePtr()); + // FIXME: this is far from complete if (D->isDefinition()) { diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp index 0671710882..a704d6762d 100644 --- a/lib/Frontend/PCHWriterDecl.cpp +++ b/lib/Frontend/PCHWriterDecl.cpp @@ -136,7 +136,14 @@ void PCHDeclWriter::VisitNamedDecl(NamedDecl *D) { 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) { @@ -591,6 +598,9 @@ void PCHDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *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); |