From 04cb14791e064bcf5c322123297f232bf8c4cc21 Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Tue, 13 Jun 2023 01:03:52 -0700 Subject: [PATCH] Clang tool: Enable incremental pre-processing This avoids doing extra work when processing multiple input files. PiperOrigin-RevId: 539884025 Change-Id: I8e48495f33c09bc53e70f4d5c1d730fe7c1202b2 --- sandboxed_api/tools/clang_generator/generator.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sandboxed_api/tools/clang_generator/generator.h b/sandboxed_api/tools/clang_generator/generator.h index 218981f..5cd118e 100644 --- a/sandboxed_api/tools/clang_generator/generator.h +++ b/sandboxed_api/tools/clang_generator/generator.h @@ -26,6 +26,7 @@ #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/CompilerInvocation.h" #include "clang/Frontend/FrontendAction.h" +#include "clang/Lex/Preprocessor.h" #include "clang/Tooling/Tooling.h" #include "sandboxed_api/tools/clang_generator/emitter.h" #include "sandboxed_api/tools/clang_generator/types.h" @@ -116,6 +117,11 @@ class GeneratorAction : public clang::ASTFrontendAction { emitter_, options_); } + bool BeginSourceFileAction(clang::CompilerInstance& ci) override { + ci.getPreprocessor().enableIncrementalProcessing(); + return true; + } + bool hasCodeCompletionSupport() const override { return false; } Emitter& emitter_;