https://github.com/fsfod created https://github.com/llvm/llvm-project/pull/112304
Update clangDaemonTweaks cmake target to set explicit symbol visibility macros to correct mode for windows. This will fix linker duplicate symbols errors from clangDaemonTweaks exporting clang symbols instead of importing them for windows shared library builds using explicit symbol visibly. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM/Clang plugins on window. >From d41e927e0f437e09cb320b4594f958cb18e30116 Mon Sep 17 00:00:00 2001 From: Thomas Fransham <tfrans...@gmail.com> Date: Tue, 15 Oct 2024 04:42:35 +0100 Subject: [PATCH] [clangd] Update clangDaemonTweaks to set symbol visibility macros correctly This will fix linker duplicate symbols errors from clangDaemonTweaks exporting clang symbols instead of importing them for windows shared library builds using explicit symbol visibly. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and LLVM/Clang plugins on window. --- clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt | 2 +- clang/cmake/modules/AddClang.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt b/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt index 59475b0dfd3d22..fa4ccba52e8831 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt +++ b/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt @@ -11,7 +11,7 @@ set(LLVM_LINK_COMPONENTS # To enable these tweaks in executables or shared libraries, add # $<TARGET_OBJECTS:obj.clangDaemonTweaks> to a list of sources, see # clangd/tool/CMakeLists.txt for an example. -add_clang_library(clangDaemonTweaks OBJECT +add_clang_library(clangDaemonTweaks CLANG_IMPORT OBJECT AddUsing.cpp AnnotateHighlightings.cpp DumpAST.cpp diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake index 091aec98e93ca3..33f47190afa26e 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake @@ -47,7 +47,7 @@ endmacro() macro(add_clang_library name) cmake_parse_arguments(ARG - "SHARED;STATIC;INSTALL_WITH_TOOLCHAIN" + "SHARED;STATIC;INSTALL_WITH_TOOLCHAIN;CLANG_IMPORT" "" "ADDITIONAL_HEADERS" ${ARGN}) @@ -114,7 +114,7 @@ macro(add_clang_library name) if(TARGET "obj.${name}") target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC) endif() - elseif(NOT ARG_SHARED AND NOT ARG_STATIC) + elseif(NOT ARG_SHARED AND NOT ARG_STATIC AND NOT ARG_CLANG_IMPORT) # Clang component libraries linked in to clang-cpp are declared without SHARED or STATIC target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS) endif() _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits