[clang] 63ccf78 - [CMake][CodeGen] Add PCH for Clang CodeGen (#206018)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 26 03:52:45 PDT 2026
Author: Alexis Engelke
Date: 2026-06-26T12:52:40+02:00
New Revision: 63ccf78848a743eac08871d24151fef70bde2978
URL: https://github.com/llvm/llvm-project/commit/63ccf78848a743eac08871d24151fef70bde2978
DIFF: https://github.com/llvm/llvm-project/commit/63ccf78848a743eac08871d24151fef70bde2978.diff
LOG: [CMake][CodeGen] Add PCH for Clang CodeGen (#206018)
The change to CGCall is required to avoid collisions of operator|=.
Added:
clang/lib/CodeGen/pch.h
Modified:
clang/lib/CodeGen/CGCall.h
clang/lib/CodeGen/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 675c448ab0b00..5df7f0d08d070 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -21,6 +21,7 @@
#include "clang/AST/CanonicalType.h"
#include "clang/AST/GlobalDecl.h"
#include "clang/AST/Type.h"
+#include "clang/Basic/BitmaskEnum.h"
#include "clang/CodeGen/ModuleLinker.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/IR/Value.h"
@@ -411,28 +412,9 @@ enum class FnInfoOpts {
IsInstanceMethod = 1 << 0,
IsChainCall = 1 << 1,
IsDelegateCall = 1 << 2,
+ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/IsDelegateCall)
};
-inline FnInfoOpts operator|(FnInfoOpts A, FnInfoOpts B) {
- return static_cast<FnInfoOpts>(llvm::to_underlying(A) |
- llvm::to_underlying(B));
-}
-
-inline FnInfoOpts operator&(FnInfoOpts A, FnInfoOpts B) {
- return static_cast<FnInfoOpts>(llvm::to_underlying(A) &
- llvm::to_underlying(B));
-}
-
-inline FnInfoOpts &operator|=(FnInfoOpts &A, FnInfoOpts B) {
- A = A | B;
- return A;
-}
-
-inline FnInfoOpts &operator&=(FnInfoOpts &A, FnInfoOpts B) {
- A = A & B;
- return A;
-}
-
struct DisableDebugLocationUpdates {
CodeGenFunction &CGF;
DisableDebugLocationUpdates(CodeGenFunction &CGF);
diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt
index d003ec209f051..853f038c4186b 100644
--- a/clang/lib/CodeGen/CMakeLists.txt
+++ b/clang/lib/CodeGen/CMakeLists.txt
@@ -163,6 +163,10 @@ add_clang_library(clangCodeGen
TrapReasonBuilder.cpp
VarBypassDetector.cpp
+ DISABLE_PCH_REUSE # PCH contains private headers
+ PRECOMPILE_HEADERS
+ [["pch.h"]]
+
DEPENDS
vt_gen
intrinsics_gen
diff --git a/clang/lib/CodeGen/pch.h b/clang/lib/CodeGen/pch.h
new file mode 100644
index 0000000000000..137fe034dd83b
--- /dev/null
+++ b/clang/lib/CodeGen/pch.h
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// Precompiled header for clangCodeGen. Uses private headers.
+///
+//===----------------------------------------------------------------------===//
+
+#include "ABIInfoImpl.h"
+#include "Address.h"
+#include "CGBuilder.h"
+#include "CGCXXABI.h"
+#include "CGValue.h"
+#include "CodeGenFunction.h"
+#include "CodeGenModule.h"
+#include "clang/AST/pch.h"
+#include "llvm/IR/pch.h"
+#include "llvm/Support/pch.h"
More information about the cfe-commits
mailing list