[llvm] [llvm] annotate ABIBreakingChecks symobls for DLL export (PR #145575)
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 7 09:00:29 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)
----------------
compnerd wrote:
Having this drift in configuration from `LLVM_ABI` seems worrisome. Is there anything that we can do to ensure that the code is impossible to drift? I'd rather have the layering violation than that. The constant here is to be homed within LLVM itself right?
https://github.com/llvm/llvm-project/pull/145575
More information about the llvm-commits
mailing list