]> granicus.if.org Git - clang/commitdiff
When collecting all of the redeclarations of a declaration loaded from
authorDouglas Gregor <dgregor@apple.com>
Tue, 17 Jan 2012 18:13:45 +0000 (18:13 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 17 Jan 2012 18:13:45 +0000 (18:13 +0000)
a module file, be sure to also add the first (potentially canonical)
declarations to the chain. This isn't guaranteed to occur because the
first declaration is not listed in the stored redeclaration chain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148314 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReaderDecl.cpp

index 7fc54bbba4161198882ece61cbcaef665db3533b..1f908e765120bb5bd792455a09617e5ec0f24aa4 100644 (file)
@@ -2131,7 +2131,10 @@ namespace {
                        llvm::SmallPtrSet<Decl *, 16> &Deserialized,
                        GlobalDeclID CanonID)
       : Reader(Reader), SearchDecls(SearchDecls), Deserialized(Deserialized),
-        CanonID(CanonID) { }
+        CanonID(CanonID) { 
+      for (unsigned I = 0, N = SearchDecls.size(); I != N; ++I)
+        addToChain(Reader.GetDecl(SearchDecls[I]));
+    }
     
     static bool visit(ModuleFile &M, bool Preorder, void *UserData) {
       if (Preorder)