[flang-commits] [flang] 2ba7f11 - [CMake] Enable warnings for PCH (#176566)
via flang-commits
flang-commits at lists.llvm.org
Sat Jan 17 08:34:33 PST 2026
Author: Alexis Engelke
Date: 2026-01-17T17:34:29+01:00
New Revision: 2ba7f11bce7f9c3cc4563524b5fbf7e664aa8862
URL: https://github.com/llvm/llvm-project/commit/2ba7f11bce7f9c3cc4563524b5fbf7e664aa8862
DIFF: https://github.com/llvm/llvm-project/commit/2ba7f11bce7f9c3cc4563524b5fbf7e664aa8862.diff
LOG: [CMake] Enable warnings for PCH (#176566)
CMake unfortunately disables this by default...
Added:
Modified:
flang/include/flang/Lower/DirectivesCommon.h
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/flang/include/flang/Lower/DirectivesCommon.h b/flang/include/flang/Lower/DirectivesCommon.h
index 8d90b525aefce..195c2f6102066 100644
--- a/flang/include/flang/Lower/DirectivesCommon.h
+++ b/flang/include/flang/Lower/DirectivesCommon.h
@@ -527,8 +527,8 @@ fir::factory::AddrAndBoundsInfo gatherDataOperandAddrAndBounds(
builder, operandLocation, dataExv, dataExvIsAssumedSize,
strideIncludeLowerExtent);
}
- if (genDefaultBounds && fir::characterWithDynamicLen(
- fir::unwrapRefType(info.addr.getType())) ||
+ if ((genDefaultBounds && fir::characterWithDynamicLen(
+ fir::unwrapRefType(info.addr.getType()))) ||
mlir::isa<fir::BoxCharType>(
fir::unwrapRefType(info.addr.getType()))) {
bounds = {fir::factory::genBoundsOpFromBoxChar<BoundsOp, BoundsType>(
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 311123084bf58..8b7c8cd4028bd 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1304,6 +1304,13 @@ if (LLVM_BUILD_INSTRUMENTED AND LLVM_BUILD_INSTRUMENTED_COVERAGE)
message(FATAL_ERROR "LLVM_BUILD_INSTRUMENTED and LLVM_BUILD_INSTRUMENTED_COVERAGE cannot both be specified")
endif()
+if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
+ # CMake weirdly marks all PCH as system headers. This undocumented variable
+ # can be used to suppress the "#pragma clang system_header".
+ # See: https://gitlab.kitware.com/cmake/cmake/-/issues/21219
+ set(CMAKE_PCH_PROLOGUE "")
+endif()
+
set(LLVM_THINLTO_CACHE_PATH "${PROJECT_BINARY_DIR}/lto.cache" CACHE STRING "Set ThinLTO cache path. This can be used when building LLVM from several
diff erent directiories.")
if(LLVM_ENABLE_LTO AND WIN32 AND NOT LINKER_IS_LLD_LINK AND NOT MINGW)
More information about the flang-commits
mailing list