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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon May 20 07:27:18 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);
----------------
AaronBallman wrote:

If we have performance numbers that suggest this is a hot path and we need the split, then we can keep it. But in general, we [document](https://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates) that particular pattern:

> "Note that you should not use an isa<> test followed by a cast<>, for that use the dyn_cast<> operator."

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


More information about the cfe-commits mailing list