[flang-commits] [clang] [flang] [llvm] [mlir] [cmake] Fix clang-cl PCH mismatches in static builds (PR #191552)
Alexis Engelke via flang-commits
flang-commits at lists.llvm.org
Sat Apr 11 00:20:38 PDT 2026
================
@@ -107,6 +107,41 @@ function(llvm_update_pch name)
set(ARG_DISABLE_PCH_REUSE ON)
endif()
+ # Certain compile definitions change macro expansion in ways that conflict
+ # with a reused PCH (e.g. visibility macros, MSVC STL config, test-only
+ # code guards). Collect both target-level and directory-level definitions
+ # and disable PCH reuse when any of these are present but absent from the
+ # PCH source. Definitions may appear as "FOO" or "FOO=value".
+ set(_pch_conflict_defs
+ LLVM_BUILD_STATIC CLANG_BUILD_STATIC
+ _ENABLE_EXTENDED_ALIGNED_STORAGE
+ MLIR_INCLUDE_TESTS FLANG_INCLUDE_TESTS)
----------------
aengelke wrote:
Mild nack for hard-coding these values here. This is not maintainable. {MLIR,FLANG}_INCLUDE_TESTS really shouldn't be set outside of the {5,1} source files that actually use it. _ENABLE_EXTENDED_ALIGNED_STORAGE seems like a bug fix for broken MSVC that we maybe should enable globally?
https://github.com/llvm/llvm-project/pull/191552
More information about the flang-commits
mailing list