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

Michael Park via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 6 00:50:59 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);
+  }
----------------
mpark wrote:

Ah I see. Okay, I'm thinking now that we might be back to the second observation I made in #121245, where the generation numbers get updated without the update actually happening. When I step through the `dataPtr()` invocation, I see that the `getMostRecentDecl()` call on [4] doesn't do anything because the generation numbers already match. I'll have to continue tomorrow.

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


More information about the cfe-commits mailing list