Skip to content

Commit d41e927

Browse files
committed
[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.
1 parent 39ac8b2 commit d41e927

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set(LLVM_LINK_COMPONENTS
1111
# To enable these tweaks in executables or shared libraries, add
1212
# $<TARGET_OBJECTS:obj.clangDaemonTweaks> to a list of sources, see
1313
# clangd/tool/CMakeLists.txt for an example.
14-
add_clang_library(clangDaemonTweaks OBJECT
14+
add_clang_library(clangDaemonTweaks CLANG_IMPORT OBJECT
1515
AddUsing.cpp
1616
AnnotateHighlightings.cpp
1717
DumpAST.cpp

clang/cmake/modules/AddClang.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ endmacro()
4747

4848
macro(add_clang_library name)
4949
cmake_parse_arguments(ARG
50-
"SHARED;STATIC;INSTALL_WITH_TOOLCHAIN"
50+
"SHARED;STATIC;INSTALL_WITH_TOOLCHAIN;CLANG_IMPORT"
5151
""
5252
"ADDITIONAL_HEADERS"
5353
${ARGN})
@@ -114,7 +114,7 @@ macro(add_clang_library name)
114114
if(TARGET "obj.${name}")
115115
target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC)
116116
endif()
117-
elseif(NOT ARG_SHARED AND NOT ARG_STATIC)
117+
elseif(NOT ARG_SHARED AND NOT ARG_STATIC AND NOT ARG_CLANG_IMPORT)
118118
# Clang component libraries linked in to clang-cpp are declared without SHARED or STATIC
119119
target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS)
120120
endif()

0 commit comments

Comments
 (0)