[cfe-commits] r107665 - in /cfe/trunk/lib/Frontend: PCHReaderDecl.cpp PCHWriterDecl.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Jul 6 08:37:09 PDT 2010


Author: akirtzidis
Date: Tue Jul  6 10:37:09 2010
New Revision: 107665

URL: http://llvm.org/viewvc/llvm-project?rev=107665&view=rev
Log:
Read/write function template specializations for PCH, properly this time.

Modified:
    cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
    cfe/trunk/lib/Frontend/PCHWriterDecl.cpp

Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=107665&r1=107664&r2=107665&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Tue Jul  6 10:37:09 2010
@@ -977,9 +977,12 @@
   if (PrevDecl == 0) {
     // This FunctionTemplateDecl owns a CommonPtr; read it.
 
-    // FunctionTemplateSpecializationInfos are filled through the
-    // templated FunctionDecl's setFunctionTemplateSpecialization, no need to
-    // read them here.
+    // Read the function specialization declarations.
+    // FunctionTemplateDecl's FunctionTemplateSpecializationInfos are filled
+    // through the specialized FunctionDecl's setFunctionTemplateSpecialization.
+    unsigned NumSpecs = Record[Idx++];
+    while (NumSpecs--)
+      Reader.GetDecl(Record[Idx++]);
 
     if (FunctionTemplateDecl *CTD
           = cast_or_null<FunctionTemplateDecl>(Reader.GetDecl(Record[Idx++]))) {

Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=107665&r1=107664&r2=107665&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Tue Jul  6 10:37:09 2010
@@ -923,9 +923,12 @@
   if (D->getPreviousDeclaration() == 0) {
     // This FunctionTemplateDecl owns the CommonPtr; write it.
 
-    // FunctionTemplateSpecializationInfos are filled through the
-    // templated FunctionDecl's setFunctionTemplateSpecialization, no need to
-    // write them here.
+    // Write the function specialization declarations.
+    Record.push_back(D->getSpecializations().size());
+    for (llvm::FoldingSet<FunctionTemplateSpecializationInfo>::iterator
+           I = D->getSpecializations().begin(),
+           E = D->getSpecializations().end()   ; I != E; ++I)
+      Writer.AddDeclRef(I->Function, Record);
 
     Writer.AddDeclRef(D->getInstantiatedFromMemberTemplate(), Record);
     if (D->getInstantiatedFromMemberTemplate())





More information about the cfe-commits mailing list