Skip to content

Commit 2de83a0

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 617278e commit 2de83a0

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})
@@ -115,7 +115,7 @@ macro(add_clang_library name)
115115
if(TARGET "obj.${name}")
116116
target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC)
117117
endif()
118-
elseif(TARGET "obj.${name}" AND NOT ARG_SHARED AND NOT ARG_STATIC)
118+
elseif(TARGET "obj.${name}" AND NOT ARG_SHARED AND NOT ARG_STATIC AND NOT ARG_CLANG_IMPORT)
119119
# Clang component libraries linked to clang-cpp are declared without SHARED or STATIC
120120
target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS)
121121
endif()

0 commit comments

Comments
 (0)