[cfe-commits] r107884 - in /cfe/trunk: include/clang/AST/DeclTemplate.h lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriterDecl.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Jul 8 10:12:57 PDT 2010
Author: akirtzidis
Date: Thu Jul 8 12:12:57 2010
New Revision: 107884
URL: http://llvm.org/viewvc/llvm-project?rev=107884&view=rev
Log:
Support TemplateTemplateParmDecl for PCH.
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=107884&r1=107883&r2=107884&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Thu Jul 8 12:12:57 2010
@@ -908,6 +908,9 @@
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const TemplateTemplateParmDecl *D) { return true; }
static bool classofKind(Kind K) { return K == TemplateTemplateParm; }
+
+ friend class PCHDeclReader;
+ friend class PCHDeclWriter;
};
/// \brief Represents a class template specialization, which refers to
Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=107884&r1=107883&r2=107884&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Thu Jul 8 12:12:57 2010
@@ -856,7 +856,8 @@
void PCHDeclReader::VisitTemplateDecl(TemplateDecl *D) {
VisitNamedDecl(D);
- NamedDecl *TemplatedDecl = cast<NamedDecl>(Reader.GetDecl(Record[Idx++]));
+ NamedDecl *TemplatedDecl
+ = cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++]));
TemplateParameterList* TemplateParams
= Reader.ReadTemplateParameterList(Record, Idx);
D->init(TemplatedDecl, TemplateParams);
@@ -1020,7 +1021,14 @@
}
void PCHDeclReader::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
- assert(false && "cannot read TemplateTemplateParmDecl");
+ VisitTemplateDecl(D);
+ // TemplateParmPosition.
+ D->setDepth(Record[Idx++]);
+ D->setPosition(Record[Idx++]);
+ // Rest of TemplateTemplateParmDecl.
+ TemplateArgumentLoc Arg = Reader.ReadTemplateArgumentLoc(Record, Idx);
+ bool IsInherited = Record[Idx++];
+ D->setDefaultArgument(Arg, IsInherited);
}
void PCHDeclReader::VisitStaticAssertDecl(StaticAssertDecl *D) {
@@ -1382,7 +1390,7 @@
QualType(),0);
break;
case pch::DECL_TEMPLATE_TEMPLATE_PARM:
- assert(false && "cannot read TemplateTemplateParmDecl");
+ D = TemplateTemplateParmDecl::Create(*Context, 0, SourceLocation(),0,0,0,0);
break;
case pch::DECL_STATIC_ASSERT:
assert(false && "cannot read StaticAssertDecl");
Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=107884&r1=107883&r2=107884&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Thu Jul 8 12:12:57 2010
@@ -963,7 +963,14 @@
}
void PCHDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
- assert(false && "cannot write TemplateTemplateParmDecl");
+ VisitTemplateDecl(D);
+ // TemplateParmPosition.
+ Record.push_back(D->getDepth());
+ Record.push_back(D->getPosition());
+ // Rest of TemplateTemplateParmDecl.
+ Writer.AddTemplateArgumentLoc(D->getDefaultArgument(), Record);
+ Record.push_back(D->defaultArgumentWasInherited());
+ Code = pch::DECL_TEMPLATE_TEMPLATE_PARM;
}
void PCHDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
More information about the cfe-commits
mailing list