Skip to content

Commit 455babb

Browse files
committed
[Flang][Windows] Disable PCH on Windows for flangFrontend
This patch fixes PCH staleness errors (fatal error: ... mtime changed) for flangFrontend during incremental Windows builds. The error occurs because the automatic CMake re-run during incremental builds updates the timestamp of the PCH source file (cmake_pch.cxx) relative to the existing PCH artifact (.pch). This happens even without direct modifications to the headers listed for precompilation. Apparently, flangFrontend is the only known LLVM target which uses target_precompile_headers, and this mechanism fails to reliably force a PCH rebuild after the CMake re-run in this Windows environment.
1 parent 9222607 commit 455babb

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

flang/lib/Frontend/CMakeLists.txt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,16 @@ add_flang_library(flangFrontend
7373
clangDriver
7474
)
7575

76-
target_precompile_headers(flangFrontend PRIVATE
77-
[["flang/Parser/parsing.h"]]
78-
[["flang/Parser/parse-tree.h"]]
79-
[["flang/Parser/dump-parse-tree.h"]]
80-
[["flang/Lower/PFTBuilder.h"]]
81-
[["flang/Lower/Bridge.h"]]
82-
)
76+
# Precompiled Headers for flangFrontend
77+
# Only enable PCH on non-Windows platforms, as the current usage of
78+
# target_precompile_headers appears fragile during incremental builds
79+
# involving CMake regeneration specifically on Windows.
80+
if(NOT WIN32)
81+
target_precompile_headers(flangFrontend PRIVATE
82+
[["flang/Parser/parsing.h"]]
83+
[["flang/Parser/parse-tree.h"]]
84+
[["flang/Parser/dump-parse-tree.h"]]
85+
[["flang/Lower/PFTBuilder.h"]]
86+
[["flang/Lower/Bridge.h"]]
87+
)
88+
endif()

0 commit comments

Comments
 (0)