[cfe-commits] r148182 - in /cfe/trunk/lib: AST/DeclTemplate.cpp Serialization/ASTWriterDecl.cpp

Douglas Gregor dgregor at apple.com
Sat Jan 14 07:30:55 PST 2012


Author: dgregor
Date: Sat Jan 14 09:30:55 2012
New Revision: 148182

URL: http://llvm.org/viewvc/llvm-project?rev=148182&view=rev
Log:
Add a FIXME for mutation of the common pointer of a RedeclarableTemplateDecl. It is not clear that it's worth delaying the allocation of said pointer

Modified:
    cfe/trunk/lib/AST/DeclTemplate.cpp
    cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=148182&r1=148181&r2=148182&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Sat Jan 14 09:30:55 2012
@@ -127,8 +127,12 @@
     }
 
     // If we never found a common pointer, allocate one now.
-    if (!Common)
+    if (!Common) {
+      // FIXME: If any of the declarations is from an AST file, we probably
+      // need an update record to add the common data.
+      
       Common = newCommon(getASTContext());
+    }
     
     // Update any previous declarations we saw with the common pointer.
     for (unsigned I = 0, N = PrevDecls.size(); I != N; ++I)

Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=148182&r1=148181&r2=148182&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Sat Jan 14 09:30:55 2012
@@ -1237,9 +1237,11 @@
 
 template <typename T>
 void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
+  T *First = D->getFirstDeclaration();
+  Writer.AddDeclRef(First);
+  
   enum { FirstDeclaration = 0, FirstInFile, PointsToPrevious };
   T *Prev = D->getPreviousDeclaration();
-  T *First = D->getFirstDeclaration();
   
   if (!Prev) {
     Record.push_back(FirstDeclaration);





More information about the cfe-commits mailing list