mirror-llvm-project/clang/unittests/DirectoryWatcher
bala-bhargav 507d1856cc
[clang][unittests] Fix linker error for DirectoryWatcherTest with CLANG_LINK_CLANG_DYLIB (#178455)
Move clangDirectoryWatcher from LINK_LIBS to CLANG_LIBS so it gets
replaced by clang-cpp when building with CLANG_LINK_CLANG_DYLIB=ON.

When using both CLANG_LINK_CLANG_DYLIB=ON and LLVM_ENABLE_LTO=Thin, the
test would fail with:
ld.lld: error: undefined symbol:
clang::DirectoryWatcher::create(llvm::StringRef, std::function<void
(llvm::ArrayRef

This happens because clangDirectoryWatcher was being linked as a
separate library alongside clang-cpp (which already contains
clangDirectoryWatcher), causing duplicate symbol issues with LTO.

The fix correctly categorizes:
- clangDirectoryWatcher → CLANG_LIBS (Clang library, bundled in
clang-cpp)
- LLVMTestingSupport → LINK_LIBS (LLVM library, always linked directly)

#178302
2026-01-28 21:23:29 -10:00
..
CMakeLists.txt [clang][unittests] Fix linker error for DirectoryWatcherTest with CLANG_LINK_CLANG_DYLIB (#178455) 2026-01-28 21:23:29 -10:00
DirectoryWatcherTest.cpp