[cfe-commits] Fwd: r106393 - in /cfe/trunk: lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriterDecl.cpp test/PCH/cxx-templates.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Jun 21 12:59:15 PDT 2010
Hey Doug,
Could you take a look at this when you have some time ? This was due to the way ASTContext::getInjectedClassNameType works.
-Argiris
Begin forwarded message:
> From: Argyrios Kyrtzidis <akyrtzi at gmail.com>
> Date: June 19, 2010 8:29:21 PM GMT+01:00
> To: cfe-commits at cs.uiuc.edu
> Subject: [cfe-commits] r106393 - in /cfe/trunk: lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriterDecl.cpp test/PCH/cxx-templates.cpp
>
> Author: akirtzidis
> Date: Sat Jun 19 14:29:21 2010
> New Revision: 106393
>
> URL: http://llvm.org/viewvc/llvm-project?rev=106393&view=rev
> Log:
> Include a hack to allow loading of templated CXXRecordDecls and test template reading from PCH.
>
> Modified:
> cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
> cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
> cfe/trunk/test/PCH/cxx-templates.cpp
>
> Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=106393&r1=106392&r2=106393&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
> +++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Sat Jun 19 14:29:21 2010
> @@ -590,6 +590,9 @@
> }
> }
>
> + // FIXME: Hack. See PCHDeclWriter::VisitTypeDecl.
> + D->setTypeForDecl(Reader.GetType(Record[Idx++]).getTypePtr());
> +
> // FIXME: this is far from complete
>
> if (D->isDefinition()) {
>
> Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=106393&r1=106392&r2=106393&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
> +++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Sat Jun 19 14:29:21 2010
> @@ -136,7 +136,14 @@
>
> 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 @@
> 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);
>
> Modified: cfe/trunk/test/PCH/cxx-templates.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-templates.cpp?rev=106393&r1=106392&r2=106393&view=diff
> ==============================================================================
> --- cfe/trunk/test/PCH/cxx-templates.cpp (original)
> +++ cfe/trunk/test/PCH/cxx-templates.cpp Sat Jun 19 14:29:21 2010
> @@ -1,3 +1,4 @@
> // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-templates.h
> +// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s
>
> -// Placeholder for stuff using the header.
> +S<float> v;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100621/31d08314/attachment.html>
More information about the cfe-commits
mailing list