From: Douglas Gregor Date: Tue, 17 Jan 2012 18:13:45 +0000 (+0000) Subject: When collecting all of the redeclarations of a declaration loaded from X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3efe999a9a3b7b71cf18d8751ec6068f24425c1b;p=clang When collecting all of the redeclarations of a declaration loaded from 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 --- diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 7fc54bbba4..1f908e7651 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -2131,7 +2131,10 @@ namespace { llvm::SmallPtrSet &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)