-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[libclang] Add missing dllexport annotation #147108
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
Conversation
All other declarations of clang-c already have CINDEX_LINKAGE.
@llvm/pr-subscribers-clang Author: Tomohiro Kashiwada (kikairoya) ChangesAll other declarations of clang-c already have CINDEX_LINKAGE. Full diff: https://github.com/llvm/llvm-project/pull/147108.diff 1 Files Affected:
diff --git a/clang/include/clang-c/FatalErrorHandler.h b/clang/include/clang-c/FatalErrorHandler.h
index 22f34fa815ccf..4f18980dea240 100644
--- a/clang/include/clang-c/FatalErrorHandler.h
+++ b/clang/include/clang-c/FatalErrorHandler.h
@@ -11,6 +11,7 @@
#define LLVM_CLANG_C_FATAL_ERROR_HANDLER_H
#include "clang-c/ExternC.h"
+#include "clang-c/Platform.h"
LLVM_CLANG_C_EXTERN_C_BEGIN
@@ -18,14 +19,14 @@ LLVM_CLANG_C_EXTERN_C_BEGIN
* Installs error handler that prints error message to stderr and calls abort().
* Replaces currently installed error handler (if any).
*/
-void clang_install_aborting_llvm_fatal_error_handler(void);
+CINDEX_LINKAGE void clang_install_aborting_llvm_fatal_error_handler(void);
/**
* Removes currently installed error handler (if any).
* If no error handler is intalled, the default strategy is to print error
* message to stderr and call exit(1).
*/
-void clang_uninstall_llvm_fatal_error_handler(void);
+CINDEX_LINKAGE void clang_uninstall_llvm_fatal_error_handler(void);
LLVM_CLANG_C_EXTERN_C_END
|
AFAIK the dllexport annotations have been added using some automated tools, so it may be good to find the person who added the other annotations, so it can be looked into why this was missing here, if the annotations otherwise were seemingly complete enough. |
Sorry, not sure if this applies here though, I guess the clang-c interface has been available as DLL with dllexports even before, while the C++ interfaces is what is getting dllexport attributes added. Still it may be good to figure out why this hasn't been an issue so far, for whoever otherwise were using these dllexport annotations. |
According to git-blame, CINDEX_LINKAGE has been in use for over 16 years. https://github.com/llvm/llvm-project/blame/a124a46748357b9e654adce7a50318a5f0648e48/clang/include/clang-c/Index.h
I suspect it relates to module definition file (*.def). On MinGW, the symbol is properly exported without annotation.
I'll try dig it. |
Regular win32 targets use llvm-project/clang/tools/libclang/CMakeLists.txt Lines 95 to 98 in 5335925
It seems Even if exported symbols are controlled by |
llvm-project/clang/tools/libclang/CMakeLists.txt Lines 88 to 93 in 5335925
MSVC doesn't use
|
That sounds like a good addition too, even if we're doing this as well?
Yeah, making that complete sounds good to me. |
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.
LGTM, but can you amend the PR description with the extra info you gathered, about why this hasn't been an issue in other existing configurations?
Thanks.
Yes, it's not mandatory but seems to be recommended. I will submit a new PR later. |
|
All other declarations of clang-c already have CINDEX_LINKAGE.
This missing annotation causes a linker error when building
tools/clang/unittests/libclang/CrashTests/libclangCrashTests.exe
for the Cygwin target.On the regular Win32 target, this issue went unnoticed because the entire libclang gtest-based testsuite is currently disabled for that platform.