[clang] [clang-repl] Delegate CodeGen related operations for PTU to IncrementalParser (PR #137458)
Anutosh Bhat via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 26 05:14:21 PDT 2025
================
@@ -0,0 +1,90 @@
+//===--- IncrementalAction.h - Incremental Frontend Action -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_INTERPRETER_INCREMENTALACTION_H
+#define LLVM_CLANG_INTERPRETER_INCREMENTALACTION_H
+
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Frontend/MultiplexConsumer.h"
+
+namespace llvm {
+class Module;
+}
+
+namespace clang {
+
+class Interpreter;
+class CodeGenerator;
+
+/// A custom action enabling the incremental processing functionality.
+///
+/// The usual \p FrontendAction expects one call to ExecuteAction and once it
+/// sees a call to \p EndSourceFile it deletes some of the important objects
+/// such as \p Preprocessor and \p Sema assuming no further input will come.
+///
+/// \p IncrementalAction ensures it keep its underlying action's objects alive
+/// as long as the \p IncrementalParser needs them.
+///
+class IncrementalAction : public WrapperFrontendAction {
+private:
+ bool IsTerminating = false;
+ Interpreter &Interp;
+ CompilerInstance &CI;
----------------
anutosh491 wrote:
Ahh thanks for reporting this. I've proposed a fix here https://github.com/llvm/llvm-project/pull/155400
https://github.com/llvm/llvm-project/pull/137458
More information about the cfe-commits
mailing list