[PATCH] D74907: libclang: Make shared object symbol exporting by default
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 20 11:33:44 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7a7c753b0cca: libclang: Make shared object symbol exporting by default (authored by cristian.adam, committed by thakis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74907/new/
https://reviews.llvm.org/D74907
Files:
clang/include/clang-c/Platform.h
clang/tools/libclang/CMakeLists.txt
Index: clang/tools/libclang/CMakeLists.txt
===================================================================
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -77,7 +77,7 @@
set(LLVM_EXPORTED_SYMBOL_FILE)
endif()
-if(LLVM_ENABLE_PIC)
+if(LLVM_ENABLE_PIC OR NOT LIBCLANG_BUILD_STATIC)
set(ENABLE_SHARED SHARED)
endif()
@@ -113,8 +113,15 @@
Support
)
+if(ENABLE_STATIC)
+ foreach(name libclang obj.libclang libclang_static)
+ if (TARGET ${name})
+ target_compile_definitions(${name} PUBLIC CINDEX_NO_EXPORTS)
+ endif()
+ endforeach()
+endif()
+
if(ENABLE_SHARED)
- target_compile_definitions(libclang PUBLIC CINDEX_EXPORTS)
if(WIN32)
set_target_properties(libclang
PROPERTIES
Index: clang/include/clang-c/Platform.h
===================================================================
--- clang/include/clang-c/Platform.h
+++ clang/include/clang-c/Platform.h
@@ -19,6 +19,9 @@
LLVM_CLANG_C_EXTERN_C_BEGIN
/* Windows DLL import/export. */
+#ifndef CINDEX_NO_EXPORTS
+ #define CINDEX_EXPORTS
+#endif
#ifdef _WIN32
#ifdef CINDEX_EXPORTS
#ifdef _CINDEX_LIB_
@@ -27,7 +30,7 @@
#define CINDEX_LINKAGE __declspec(dllimport)
#endif
#endif
-#elif defined(CINDEX_EXPORTS)
+#elif defined(CINDEX_EXPORTS) && defined(__GNUC__)
#define CINDEX_LINKAGE __attribute__((visibility("default")))
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74907.245703.patch
Type: text/x-patch
Size: 1400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200220/dd8ea3c6/attachment.bin>
More information about the cfe-commits
mailing list