[clang] Forward declare TargetInfo to improve clang build speeds (PR #243220)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 16 12:48:42 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Abhina Sree (abhina-sree)
<details>
<summary>Changes</summary>
This patch foward declares TargetInfo in TextEncoding.cpp
---
Full diff: https://github.com/llvm/llvm-project/pull/243220.diff
2 Files Affected:
- (modified) clang/include/clang/Lex/TextEncoding.h (+3-2)
- (modified) clang/lib/Lex/TextEncoding.cpp (+1)
``````````diff
diff --git a/clang/include/clang/Lex/TextEncoding.h b/clang/include/clang/Lex/TextEncoding.h
index 1d4ac51bb764f..27318980ea266 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 3175f18cff523..7252a68585617 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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/243220
More information about the cfe-commits
mailing list