https://github.com/abhina-sree created 
https://github.com/llvm/llvm-project/pull/243220

This patch foward declares TargetInfo in TextEncoding.cpp

>From 54ce79facad5eccf88b0e5b3209cbfc756ac9156 Mon Sep 17 00:00:00 2001
From: Abhina Sreeskantharajan <[email protected]>
Date: Mon, 16 Nov 2026 15:46:46 -0500
Subject: [PATCH] forward declare TargetInfo to improve clang build speeds

---
 clang/include/clang/Lex/TextEncoding.h | 5 +++--
 clang/lib/Lex/TextEncoding.cpp         | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Lex/TextEncoding.h 
b/clang/include/clang/Lex/TextEncoding.h
index 1d4ac51bb764fc..27318980ea266a 100644
--- a/clang/include/clang/Lex/TextEncoding.h
+++ b/clang/include/clang/Lex/TextEncoding.h
@@ -10,7 +10,6 @@
 #define LLVM_CLANG_LEX_TEXTENCODING_H
 
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace llvm {
@@ -18,6 +17,8 @@ class TextEncodingConverter;
 } // namespace llvm
 
 namespace clang {
+class TargetInfo;
+
 enum ConversionAction {
   CA_NoConversion,
   CA_ToLiteralEncodingForAsm, // IBM-1047 on z/OS, UTF-8 on other platforms
@@ -52,7 +53,7 @@ class TextEncoding {
 
   static std::error_code
   setConvertersFromOptions(TextEncoding &TE, const clang::LangOptions &Opts,
-                           clang::TargetInfo &TInfo);
+                           TargetInfo &TInfo);
 
   llvm::StringRef getLiteralEncoding() { return LiteralEncoding; }
 };
diff --git a/clang/lib/Lex/TextEncoding.cpp b/clang/lib/Lex/TextEncoding.cpp
index 3175f18cff523b..7252a68585617c 100644
--- a/clang/lib/Lex/TextEncoding.cpp
+++ b/clang/lib/Lex/TextEncoding.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/Lex/TextEncoding.h"
 #include "clang/Basic/DiagnosticDriver.h"
+#include "clang/Basic/TargetInfo.h"
 #include "llvm/Support/TextEncoding.h"
 
 using namespace clang;

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to