[clang] [clang] Propagate definition data to all redecls (PR #170090)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 1 01:33:27 PST 2025


================
@@ -2107,8 +2107,8 @@ void ASTDeclMerger::MergeDefinitionData(
     auto *Def = DD.Definition;
     DD = std::move(MergeDD);
     DD.Definition = Def;
-    while ((Def = Def->getPreviousDecl()))
-      cast<CXXRecordDecl>(Def)->DefinitionData = ⅅ
+    for (auto *D : Def->redecls())
+      cast<CXXRecordDecl>(D)->DefinitionData = ⅅ
----------------
ChuanqiXu9 wrote:

BTW, if we can have noload_redecls()? redecls() may trigger loading of all redeclarations for the RD. 

This sounds very bad. But it may not be so bad as there are already many such code right now...  so I don't block this. And I'd like to promote my post here: https://discourse.llvm.org/t/request-for-discussion-clang-a-bidirectional-decl-query-system/88945

https://github.com/llvm/llvm-project/pull/170090


More information about the cfe-commits mailing list