[clang] e844447 - Revert "libclang: Add static build support for Windows" and
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 20 12:18:48 PST 2020
Author: Nico Weber
Date: 2020-02-20T15:17:51-05:00
New Revision: e84444781aad23ed66d46d23637df4768677e76e
URL: https://github.com/llvm/llvm-project/commit/e84444781aad23ed66d46d23637df4768677e76e
DIFF: https://github.com/llvm/llvm-project/commit/e84444781aad23ed66d46d23637df4768677e76e.diff
LOG: Revert "libclang: Add static build support for Windows" and
follow-up "libclang: Make shared object symbol exporting by default"
This reverts commit 7a7c753b0cca6abb61f054842fb087dfc30dc563.
This reverts commit 7ff1f55a1219719f57a6f7905c26ce41d1767e4c.
They broke building libclang.dll on Windows, see
https://reviews.llvm.org/D74564
Added:
Modified:
clang/include/clang-c/Platform.h
clang/tools/libclang/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/include/clang-c/Platform.h b/clang/include/clang-c/Platform.h
index 67c1fff8ff78..3bb66bb0df48 100644
--- a/clang/include/clang-c/Platform.h
+++ b/clang/include/clang-c/Platform.h
@@ -18,23 +18,14 @@
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_
- #define CINDEX_LINKAGE __declspec(dllexport)
- #else
- #define CINDEX_LINKAGE __declspec(dllimport)
- #endif
+/* MSVC DLL import/export. */
+#ifdef _MSC_VER
+ #ifdef _CINDEX_LIB_
+ #define CINDEX_LINKAGE __declspec(dllexport)
+ #else
+ #define CINDEX_LINKAGE __declspec(dllimport)
#endif
-#elif defined(CINDEX_EXPORTS) && defined(__GNUC__)
- #define CINDEX_LINKAGE __attribute__((visibility("default")))
-#endif
-
-#ifndef CINDEX_LINKAGE
+#else
#define CINDEX_LINKAGE
#endif
diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 3c5941e77848..bd0c945a5e12 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -77,11 +77,11 @@ if(MSVC)
set(LLVM_EXPORTED_SYMBOL_FILE)
endif()
-if(LLVM_ENABLE_PIC OR NOT LIBCLANG_BUILD_STATIC)
+if(LLVM_ENABLE_PIC OR WIN32)
set(ENABLE_SHARED SHARED)
endif()
-if(NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC)
+if((NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32)
set(ENABLE_STATIC STATIC)
endif()
@@ -113,14 +113,6 @@ add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC} INSTALL_WITH_TOOLCH
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)
if(WIN32)
set_target_properties(libclang
More information about the cfe-commits
mailing list