[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 5 20:43:37 PST 2025


================
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested,
   if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility)
     return true;
 
+  // The external source may have additional definitions of this entity that are
+  // visible, so complete the redeclaration chain now.
+  if (auto *Source = Context.getExternalSource()) {
+    Source->CompleteRedeclChain(D);
+  }
----------------
ChuanqiXu9 wrote:

the fix here looks a little bit random to me. If we need to look at other declarations, we need to call `redecls()`. But `redecls()` should complete the redecl chain, right?

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


More information about the cfe-commits mailing list