https://github.com/tclin914 created https://github.com/llvm/llvm-project/pull/187983
The unit test was guarded only by platform checks (Apple/Linux/Windows) but the library itself additionally requires CoreServices.h on macOS and sys/inotify.h on Linux. Without these header checks, the test could be built against a non-functional DirectoryWatcher backend. Align the test's build conditions with the library's header availability checks in clang/lib/DirectoryWatcher/CMakeLists.txt. >From 832aab6b9f3ca8754dc195bf646cf20bb68844d8 Mon Sep 17 00:00:00 2001 From: Jim Lin <[email protected]> Date: Mon, 23 Mar 2026 15:12:02 +0800 Subject: [PATCH] [clang] Fix DirectoryWatcher test to check for platform headers The unit test was guarded only by platform checks (Apple/Linux/Windows) but the library itself additionally requires CoreServices.h on macOS and sys/inotify.h on Linux. Without these header checks, the test could be built against a non-functional DirectoryWatcher backend. Align the test's build conditions with the library's header availability checks in clang/lib/DirectoryWatcher/CMakeLists.txt. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --- clang/unittests/DirectoryWatcher/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/clang/unittests/DirectoryWatcher/CMakeLists.txt b/clang/unittests/DirectoryWatcher/CMakeLists.txt index 28fc6cb21010c..67ce83a548e7c 100644 --- a/clang/unittests/DirectoryWatcher/CMakeLists.txt +++ b/clang/unittests/DirectoryWatcher/CMakeLists.txt @@ -1,4 +1,15 @@ -if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME STREQUAL Windows) +include(CheckIncludeFiles) + +if(APPLE) + check_include_files("CoreServices/CoreServices.h" HAVE_CORESERVICES) +endif() +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + check_include_files("sys/inotify.h" HAVE_INOTIFY) +endif() + +if((APPLE AND HAVE_CORESERVICES) OR + (CMAKE_SYSTEM_NAME MATCHES "Linux" AND HAVE_INOTIFY) OR + CMAKE_SYSTEM_NAME MATCHES "Windows") add_clang_unittest(DirectoryWatcherTests DirectoryWatcherTest.cpp _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
