[clang] [clang-repl] Restore the lookup of out-of-line definitions' predecessors (PR #229780)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 07:52:22 PDT 2026


================
@@ -268,11 +268,12 @@ class ASTDeclUnmerger : public DeclVisitor<ASTDeclUnmerger> {
         removeFromLookups(ND);
     }
 
-    // Restore lookup for the surviving predecessor
-    // of any removed decl that had a surviving predecessor
-    DeclContext *Primary = DC->getPrimaryContext();
+    // Restore lookup for the surviving predecessor of any removed decl that
+    // had a surviving predecessor. Like removeDecl(), use its semantic
+    // context: the out-of-line definition of a member is in DC, but it was
+    // removed from the lookup table of its class or namespace.
     for (NamedDecl *Prev : Survivors)
-      Primary->makeDeclVisibleInContext(Prev);
+      Prev->getDeclContext()->makeDeclVisibleInContext(Prev);
----------------
vgvassilev wrote:

This logic should go in `VisitNamedDecl`.

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


More information about the cfe-commits mailing list