-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clangd] Update clangDaemonTweaks to set symbol visibility macros #112304
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like it would change the behaviour of other libraries which were previously being built for shared linking (or at least were exporting their interfaces) to now be built for static linking (or no longer export their symbols). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do you mean, its only checking for the arg not being set, so it shouldn't change the behaviour for other libraries. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then we should be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
see: https://cmake.org/cmake/help/latest/command/cmake_parse_arguments.html So |
||
# Clang component libraries linked in to clang-cpp are declared without SHARED or STATIC | ||
target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS) | ||
endif() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unclear what this new option (
CLANG_IMPORT
) does.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not possible to infer if a OBJECT target should be importing or exporting clang symbols, this option allows OBJECT target to specify it should be importing Clang symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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?