[clang] [clang-tools-extra] [clangd] Update clangDaemonTweaks to set symbol visibility macros (PR #112304)
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 10:13:14 PST 2024
================
@@ -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"
----------------
compnerd wrote:
We should document the option. Why is it specific to clang? I think that the right semantics are, is this library built as a static library or not. The default should be dynamic. At that point, when the library is built as static, a public definition could be added at the library definition to state it is static. That would then implicitly avoid the DLL storage. Otherwise, it is implicitly DLL imported.
```c
#if defined(clang_STATIC)
# define CLANG_ABI
#else
# if defined(_WIN32)
# if defined(clang_EXPORTS)
# define CLANG_ABI __declspec(dllexport)
# else
# define CLANG_ABI __declspec(dllimport)
# endif
# else
...
# endif
```
We don't need all this new custom handling to be wired through out the build to support this. Each library needs only to know its ABI, and in the case that it's a compacted library (i.e. is an object library), we update the export symbol that CMake uses to the DLL that it is compacted into.
Am I missing something in this model?
https://github.com/llvm/llvm-project/pull/112304
More information about the cfe-commits
mailing list