diff options
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 32 | ||||
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 2 |
2 files changed, 24 insertions, 10 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index e2701cea40..568d9ce77e 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -2160,19 +2160,27 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { case pch::TYPE_DECLTYPE: return Context->getDecltypeType(ReadExpr()); - case pch::TYPE_RECORD: - if (Record.size() != 1) { + case pch::TYPE_RECORD: { + if (Record.size() != 2) { Error("incorrect encoding of record type"); return QualType(); } - return Context->getRecordType(cast<RecordDecl>(GetDecl(Record[0]))); + bool IsDependent = Record[0]; + QualType T = Context->getRecordType(cast<RecordDecl>(GetDecl(Record[1]))); + T->Dependent = IsDependent; + return T; + } - case pch::TYPE_ENUM: - if (Record.size() != 1) { + case pch::TYPE_ENUM: { + if (Record.size() != 2) { Error("incorrect encoding of enum type"); return QualType(); } - return Context->getEnumType(cast<EnumDecl>(GetDecl(Record[0]))); + bool IsDependent = Record[0]; + QualType T = Context->getEnumType(cast<EnumDecl>(GetDecl(Record[1]))); + T->Dependent = IsDependent; + return T; + } case pch::TYPE_ELABORATED: { unsigned Idx = 0; @@ -2273,16 +2281,20 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { case pch::TYPE_TEMPLATE_SPECIALIZATION: { unsigned Idx = 0; + bool IsDependent = Record[Idx++]; TemplateName Name = ReadTemplateName(Record, Idx); llvm::SmallVector<TemplateArgument, 8> Args; ReadTemplateArgumentList(Args, Record, Idx); QualType Canon = GetType(Record[Idx++]); + QualType T; if (Canon.isNull()) - return Context->getCanonicalTemplateSpecializationType(Name, Args.data(), - Args.size()); + T = Context->getCanonicalTemplateSpecializationType(Name, Args.data(), + Args.size()); else - return Context->getTemplateSpecializationType(Name, Args.data(), - Args.size(), Canon); + T = Context->getTemplateSpecializationType(Name, Args.data(), + Args.size(), Canon); + T->Dependent = IsDependent; + return T; } } // Suppress a GCC warning diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index e0009f44ab..8684a06eb0 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -194,6 +194,7 @@ void PCHTypeWriter::VisitDecltypeType(const DecltypeType *T) { } void PCHTypeWriter::VisitTagType(const TagType *T) { + Record.push_back(T->isDependentType()); Writer.AddDeclRef(T->getDecl(), Record); assert(!T->isBeingDefined() && "Cannot serialize in the middle of a type definition"); @@ -220,6 +221,7 @@ PCHTypeWriter::VisitSubstTemplateTypeParmType( void PCHTypeWriter::VisitTemplateSpecializationType( const TemplateSpecializationType *T) { + Record.push_back(T->isDependentType()); Writer.AddTemplateName(T->getTemplateName(), Record); Record.push_back(T->getNumArgs()); for (TemplateSpecializationType::iterator ArgI = T->begin(), ArgE = T->end(); |