<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Doug,<div><br></div><div>Could you take a look at this when you have some time ? This was due to the way ASTContext::getInjectedClassNameType works.</div><div><br></div><div>-Argiris<br><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Argyrios Kyrtzidis <<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">June 19, 2010 8:29:21 PM GMT+01:00<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>[cfe-commits] r106393 - in /cfe/trunk: lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriterDecl.cpp test/PCH/cxx-templates.cpp</b><br></span></div><br><div>Author: akirtzidis<br>Date: Sat Jun 19 14:29:21 2010<br>New Revision: 106393<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=106393&view=rev">http://llvm.org/viewvc/llvm-project?rev=106393&view=rev</a><br>Log:<br>Include a hack to allow loading of templated CXXRecordDecls and test template reading from PCH.<br><br>Modified:<br> cfe/trunk/lib/Frontend/PCHReaderDecl.cpp<br> cfe/trunk/lib/Frontend/PCHWriterDecl.cpp<br> cfe/trunk/test/PCH/cxx-templates.cpp<br><br>Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=106393&r1=106392&r2=106393&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=106393&r1=106392&r2=106393&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)<br>+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Sat Jun 19 14:29:21 2010<br>@@ -590,6 +590,9 @@<br> }<br> }<br><br>+ // FIXME: Hack. See PCHDeclWriter::VisitTypeDecl.<br>+ D->setTypeForDecl(Reader.GetType(Record[Idx++]).getTypePtr());<br>+<br> // FIXME: this is far from complete<br><br> if (D->isDefinition()) {<br><br>Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=106393&r1=106392&r2=106393&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=106393&r1=106392&r2=106393&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)<br>+++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Sat Jun 19 14:29:21 2010<br>@@ -136,7 +136,14 @@<br><br> void PCHDeclWriter::VisitTypeDecl(TypeDecl *D) {<br> VisitNamedDecl(D);<br>- Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);<br>+ if (isa<CXXRecordDecl>(D)) {<br>+ // FIXME: Hack. To read a templated CXXRecordDecl from PCH, we need an<br>+ // initialized CXXRecordDecl before creating an InjectedClassNameType.<br>+ // Delay emitting/reading CXXRecordDecl's TypeForDecl until when we handle<br>+ // CXXRecordDecl emitting/initialization.<br>+ Writer.AddTypeRef(QualType(), Record);<br>+ } else<br>+ Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);<br> }<br><br> void PCHDeclWriter::VisitTypedefDecl(TypedefDecl *D) {<br>@@ -591,6 +598,9 @@<br> Record.push_back(CXXRecNotTemplate);<br> }<br><br>+ // FIXME: Hack. See PCHDeclWriter::VisitTypeDecl.<br>+ Writer.AddTypeRef(QualType(D->getTypeForDecl(), 0), Record);<br>+<br> if (D->isDefinition()) {<br> unsigned NumBases = D->getNumBases();<br> Record.push_back(NumBases);<br><br>Modified: cfe/trunk/test/PCH/cxx-templates.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-templates.cpp?rev=106393&r1=106392&r2=106393&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-templates.cpp?rev=106393&r1=106392&r2=106393&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/PCH/cxx-templates.cpp (original)<br>+++ cfe/trunk/test/PCH/cxx-templates.cpp Sat Jun 19 14:29:21 2010<br>@@ -1,3 +1,4 @@<br> // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-templates.h<br>+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s <br><br>-// Placeholder for stuff using the header.<br>+S<float> v;<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></div></blockquote></div><br></div></body></html>