[clang] [clang-repl] Drop the IR of a failed input (PR #226285)
Emery Conrad via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 25 07:00:23 PDT 2026
conrade-ctc wrote:
> Can you take a look how cling does it -- it has one or two patches on top of clang -- maybe we should start from there.
Thanks. I think this PR is the cling approach. On error, cling clears the Builder in `ReleaseModule()` and starts a new module. Upstream already clears it in the `HandleTranslationUnit` error branch. This PR calls that for a failed input, as #204152 did.
The one addition is in `CodeGenModule::clear`: it keeps the deferred decls of earlier inputs and drops those of the failed input. I can move the clear into `ReleaseModule` if you prefer the literal cling form.
https://github.com/llvm/llvm-project/pull/226285
More information about the cfe-commits
mailing list