From 0a09ab1e3c024c3e797c6cc3efc86d807a35f0d4 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 14 Jul 2026 17:59:58 -0700 Subject: [PATCH] Reduce Clang header exposure in check_unit.h (#7509) Remove clang/Frontend/CompilerInvocation.h from check_unit.h and forward declare clang::CompilerInvocation instead to reduce header exposure. Add an explicit include of CompilerInvocation.h to check_unit.cpp. Assisted-by: Antigravity with Gemini --- toolchain/check/check_unit.cpp | 1 + toolchain/check/check_unit.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/toolchain/check/check_unit.cpp b/toolchain/check/check_unit.cpp index 49a067274960..9a1d9e431cff 100644 --- a/toolchain/check/check_unit.cpp +++ b/toolchain/check/check_unit.cpp @@ -9,6 +9,7 @@ #include #include +#include "clang/Frontend/CompilerInvocation.h" #include "clang/Sema/Sema.h" #include "common/growing_range.h" #include "common/pretty_stack_trace_function.h" diff --git a/toolchain/check/check_unit.h b/toolchain/check/check_unit.h index d961c81dd8cd..786e5577e073 100644 --- a/toolchain/check/check_unit.h +++ b/toolchain/check/check_unit.h @@ -5,7 +5,6 @@ #ifndef CARBON_TOOLCHAIN_CHECK_CHECK_UNIT_H_ #define CARBON_TOOLCHAIN_CHECK_CHECK_UNIT_H_ -#include "clang/Frontend/CompilerInvocation.h" #include "common/map.h" #include "llvm/ADT/SmallVector.h" #include "toolchain/check/check.h" @@ -14,6 +13,10 @@ #include "toolchain/parse/node_ids.h" #include "toolchain/sem_ir/ids.h" +namespace clang { +class CompilerInvocation; +} + namespace Carbon::Check { struct UnitAndImports;