[llvm] [llvm] annotate ABIBreakingChecks symobls for DLL export (PR #145575)
Andrew Rogers via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 7 08:17:58 PDT 2025
================
@@ -12,12 +12,36 @@
#ifndef LLVM_ABI_BREAKING_CHECKS_H
#define LLVM_ABI_BREAKING_CHECKS_H
+// llvm-config.h is required for LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS
+#include "llvm/Config/llvm-config.h"
+
/* Define to enable checks that alter the LLVM C++ ABI */
#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS
/* Define to enable reverse iteration of unordered llvm containers */
#cmakedefine01 LLVM_ENABLE_REVERSE_ITERATION
+// Properly annotate EnableABIBreakingChecks or DisableABIBreakingChecks for
+// export from shared library.
+#if !defined(LLVM_ABI_GENERATING_ANNOTATIONS)
+// TODO(https://github.com/llvm/llvm-project/issues/145406): eliminate need for
+// two preprocessor definitions to gate LLVM_ABI macro definitions.
+#if defined(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS) && !defined(LLVM_BUILD_STATIC)
+#if defined(_WIN32) && !defined(__MINGW32__)
+#if defined(LLVM_EXPORTS)
+#define ABI_BREAKING_EXPORT_ABI __declspec(dllexport)
----------------
andrurogerz wrote:
@compnerd I can definitely do that, but do you think I should then move it to a separate header (e.g. `llvm/Config/visibility.h`)? The macros are currently only used in this file nowhere else in llvm/config.
https://github.com/llvm/llvm-project/pull/145575
More information about the llvm-commits
mailing list