Author: Vitaly Buka
Date: 2026-10-09T05:57:30Z
New Revision: e6a202524cabbb615efac8f4ed413bdcddd29c4e

URL: 
https://github.com/llvm/llvm-project/commit/e6a202524cabbb615efac8f4ed413bdcddd29c4e
DIFF: 
https://github.com/llvm/llvm-project/commit/e6a202524cabbb615efac8f4ed413bdcddd29c4e.diff

LOG: [clangd] Clear LLVM_LINK_COMPONENTS for test plugin modules (#230359)

clang-tools-extra/clangd/CMakeLists.txt sets directory-scoped
LLVM_LINK_COMPONENTS (including Support), which is inherited by
clang-tools-extra/clangd/test/plugins/CMakeLists.txt.

When building ClangdFeatureModuleExample and
ClangdStandaloneTweakExample (added in #226995), llvm_add_library
statically links libLLVMSupport.a into the plugin shared libraries
unless LLVM_LINK_COMPONENTS is cleared before creating the targets.
Loading these plugins into clangd then triggers an ASan ODR violation on
llvm::vfs::FileSystem::ID because both clangd and the plugin module
contain their own copy of VirtualFileSystem.cpp.o.

Clear LLVM_LINK_COMPONENTS before calling llvm_add_library so the
plugins resolve LLVM symbols from the clangd executable at load time,
and remove the dead post-target LLVM_LINK_COMPONENTS block.

Fixing https://lab.llvm.org/buildbot/#/builders/52/builds/20707

Assisted-by: Gemini

Added: 
    

Modified: 
    clang-tools-extra/clangd/test/plugins/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/test/plugins/CMakeLists.txt 
b/clang-tools-extra/clangd/test/plugins/CMakeLists.txt
index 5097e50dbffc5..7b144ab0d88d3 100644
--- a/clang-tools-extra/clangd/test/plugins/CMakeLists.txt
+++ b/clang-tools-extra/clangd/test/plugins/CMakeLists.txt
@@ -1,3 +1,5 @@
+set(LLVM_LINK_COMPONENTS)
+
 if (NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB)
   llvm_add_library(
       ClangdFeatureModuleExample
@@ -18,11 +20,6 @@ foreach(target ClangdFeatureModuleExample 
ClangdStandaloneTweakExample)
       "${CLANG_TOOLS_SOURCE_DIR}/clangd"
       "${CMAKE_CURRENT_BINARY_DIR}/../.."
     )
-    if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
-      set(LLVM_LINK_COMPONENTS
-        Support
-      )
-    endif()
   endif()
 endforeach()
 


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to