[clang] [clang-repl] Extend the C support. (PR #89804)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 09:33:27 PDT 2024


================
@@ -407,6 +406,16 @@ void IncrementalParser::CleanUpPTU(PartialTranslationUnit &PTU) {
       }
     }
   }
+
+  // FIXME: We should de-allocate MostRecentTU
+  for (Decl *D : MostRecentTU->decls()) {
+    if (!isa<NamedDecl>(D))
+      continue;
+    // Check if we need to clean up the IdResolver chain.
+    NamedDecl *ND = cast<NamedDecl>(D);
+    if (ND->getDeclName().getFETokenInfo())
----------------
vgvassilev wrote:

If the `MostRecentTU` has a declaration which for some reason was removed from the IdResolver by exiting some lexical scope, for example? I suspect there are other language rules that may decide to make a declaration not visible to the C name lookup...

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


More information about the cfe-commits mailing list