[clang] [flang] [llvm] [mlir] [polly] [CMake][LLVM] Add PCH infrastructure and LLVMSupport PCH (PR #176420)

Alexis Engelke via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 17 08:26:51 PST 2026


================
@@ -79,6 +79,48 @@ function(llvm_update_compile_flags name)
   target_compile_definitions(${name} PRIVATE ${LLVM_COMPILE_DEFINITIONS})
 endfunction()
 
+function(llvm_update_pch name)
+  if(LLVM_REQUIRES_RTTI OR LLVM_REQUIRES_EH)
+    # Non-default RTTI/EH results in incompatible flags, precluding PCH reuse.
+    set(ARG_DISABLE_PCH_REUSE ON)
+  endif()
----------------
aengelke wrote:

The PCH compile flags must match the source file compile flags. LLVM_REQUIRES_* are per-target overrides to enable EH/RTTI (currently used by two unit tests). If the PCH is compiled without RTTI/EH but the target overrides this, the PCH cannot be used.

RTTI+EH cause different macro definitions and actually also cause different preprocessed output on some standard library headers in e.g. shared_ptr.

https://github.com/llvm/llvm-project/pull/176420


More information about the cfe-commits mailing list