[cfe-commits] r106858 - in /cfe/trunk: include/clang/Frontend/PCHBitCodes.h lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Jun 25 09:24:58 PDT 2010
Author: akirtzidis
Date: Fri Jun 25 11:24:58 2010
New Revision: 106858
URL: http://llvm.org/viewvc/llvm-project?rev=106858&view=rev
Log:
Support DependentTemplateSpecializationType and ElaboratedType for PCH.
Modified:
cfe/trunk/include/clang/Frontend/PCHBitCodes.h
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/lib/Frontend/PCHWriter.cpp
Modified: cfe/trunk/include/clang/Frontend/PCHBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHBitCodes.h?rev=106858&r1=106857&r2=106858&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHBitCodes.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHBitCodes.h Fri Jun 25 11:24:58 2010
@@ -422,8 +422,10 @@
TYPE_TEMPLATE_TYPE_PARM = 29,
/// \brief An TemplateSpecializationType record.
TYPE_TEMPLATE_SPECIALIZATION = 30,
- /// \brief An DependentNameType record.
- TYPE_DEPENDENT_NAME = 31
+ /// \brief A DependentNameType record.
+ TYPE_DEPENDENT_NAME = 31,
+ /// \brief A DependentTemplateSpecializationType record.
+ TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32
};
/// \brief The type IDs for special types constructed by semantic
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=106858&r1=106857&r2=106858&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Fri Jun 25 11:24:58 2010
@@ -2160,15 +2160,11 @@
return Context->getTypeDeclType(cast<EnumDecl>(GetDecl(Record[0])));
case pch::TYPE_ELABORATED: {
- if (Record.size() != 2) {
- Error("incorrect encoding of elaborated type");
- return QualType();
- }
- unsigned Tag = Record[1];
- // FIXME: Deserialize the qualifier (C++ only)
- return Context->getElaboratedType((ElaboratedTypeKeyword) Tag,
- /* NNS */ 0,
- GetType(Record[0]));
+ unsigned Idx = 0;
+ ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
+ NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
+ QualType NamedType = GetType(Record[Idx++]);
+ return Context->getElaboratedType(Keyword, NNS, NamedType);
}
case pch::TYPE_OBJC_INTERFACE: {
@@ -2224,6 +2220,20 @@
const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx);
return Context->getDependentNameType(Keyword, NNS, Name, QualType());
}
+
+ case pch::TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: {
+ unsigned Idx = 0;
+ ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++];
+ NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx);
+ const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx);
+ unsigned NumArgs = Record[Idx++];
+ llvm::SmallVector<TemplateArgument, 8> Args;
+ Args.reserve(NumArgs);
+ while (NumArgs--)
+ Args.push_back(ReadTemplateArgument(Record, Idx));
+ return Context->getDependentTemplateSpecializationType(Keyword, NNS, Name,
+ Args.size(), Args.data());
+ }
case pch::TYPE_TEMPLATE_SPECIALIZATION: {
unsigned Idx = 0;
Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=106858&r1=106857&r2=106858&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Fri Jun 25 11:24:58 2010
@@ -261,15 +261,20 @@
void
PCHTypeWriter::VisitDependentTemplateSpecializationType(
const DependentTemplateSpecializationType *T) {
- // FIXME: Serialize this type (C++ only)
- assert(false && "Cannot serialize dependent template specialization types");
+ Record.push_back(T->getKeyword());
+ Writer.AddNestedNameSpecifier(T->getQualifier(), Record);
+ Writer.AddIdentifierRef(T->getIdentifier(), Record);
+ Record.push_back(T->getNumArgs());
+ for (DependentTemplateSpecializationType::iterator
+ I = T->begin(), E = T->end(); I != E; ++I)
+ Writer.AddTemplateArgument(*I, Record);
+ Code = pch::TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION;
}
void PCHTypeWriter::VisitElaboratedType(const ElaboratedType *T) {
- Writer.AddTypeRef(T->getNamedType(), Record);
Record.push_back(T->getKeyword());
- // FIXME: Serialize the qualifier (C++ only)
- assert(T->getQualifier() == 0 && "Cannot serialize qualified name types");
+ Writer.AddNestedNameSpecifier(T->getQualifier(), Record);
+ Writer.AddTypeRef(T->getNamedType(), Record);
Code = pch::TYPE_ELABORATED;
}
More information about the cfe-commits
mailing list