ChuanqiXu9 wrote: > > > Unfortunately, I don't have an easy idea to fix it - going back to the > > > old code and just calling `getMostRecentDecl` at the beginning doesn't > > > pass the `Modules/GH170084.cpp` test case... > > > > > > I feel it may not be too hard to implement a `noload_redecls()`. You can > > get the most recent decl without calling `getMostRecentDecl ()` (that will > > trigger the deserialization of all redecls, I hate it) in Redeclarable.h > > internally. And you can simply traverse the redecls. > > As I hinted above, that doesn't work. More specifically, I tried > > ```diff > diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp > b/clang/lib/Serialization/ASTReaderDecl.cpp > index 882d54f31280..d63824c4ba18 100644 > --- a/clang/lib/Serialization/ASTReaderDecl.cpp > +++ b/clang/lib/Serialization/ASTReaderDecl.cpp > @@ -2107,8 +2107,9 @@ void ASTDeclMerger::MergeDefinitionData( > auto *Def = DD.Definition; > DD = std::move(MergeDD); > DD.Definition = Def; > - for (auto *D : Def->redecls()) > - cast<CXXRecordDecl>(D)->DefinitionData = ⅅ > + Def = Def->getMostRecentDecl(); > + while ((Def = Def->getPreviousDecl())) > + cast<CXXRecordDecl>(Def)->DefinitionData = ⅅ > return; > } > > ```
You can't use `getMostRecentDecl `, this will trigger deserializations. Then it is the same with before. You need to implement `noload_redecls()`, possibly in Redeclarable.h https://github.com/llvm/llvm-project/pull/133057 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
