]> granicus.if.org Git - clang/commitdiff
Read/write function template specializations for PCH, properly this time.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 6 Jul 2010 15:37:09 +0000 (15:37 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 6 Jul 2010 15:37:09 +0000 (15:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107665 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PCHReaderDecl.cpp
lib/Frontend/PCHWriterDecl.cpp

index 698adf49b54510239e52a9d7d03a7f18d83e9798..e21cbab589e9b0cde06e20fffa71d1de282124d3 100644 (file)
@@ -977,9 +977,12 @@ void PCHDeclReader::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
   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++]))) {
index 2dc59726eaebe6206ab09b402cababd7fdfb5d44..7c672bdabbbe633b035130d0ebbcf9dac21ff3d0 100644 (file)
@@ -923,9 +923,12 @@ void PCHDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
   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())