2 /*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/
4 /* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
6 /* See https://llvm.org/LICENSE.txt for license information. */
7 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
9 /*===----------------------------------------------------------------------===*/
11 /* This file controls the C++ ABI break introduced in LLVM public header. */
13 #ifndef LLVM_ABI_BREAKING_CHECKS_H
14 #define LLVM_ABI_BREAKING_CHECKS_H
16 /* Define to enable checks that alter the LLVM C++ ABI */
17 #define LLVM_ENABLE_ABI_BREAKING_CHECKS 1
19 /* Define to enable reverse iteration of unordered llvm containers */
20 #define LLVM_ENABLE_REVERSE_ITERATION 0
22 /* Allow selectively disabling link-time mismatch checking so that header-only
23 ADT content from LLVM can be used without linking libSupport. */
24 #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
26 // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
29 // Use pragma with MSVC
30 #define LLVM_XSTR(s) LLVM_STR(s)
31 #define LLVM_STR(s) #s
32 #pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
35 #elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
36 // FIXME: Implement checks without weak.
37 #elif defined(__cplusplus)
38 #if !(defined(_AIX) && defined(__GNUC__) && !defined(__clang__))
39 #define LLVM_HIDDEN_VISIBILITY __attribute__ ((visibility("hidden")))
41 // GCC on AIX does not support visibility attributes. Symbols are not
42 // exported by default on AIX.
43 #define LLVM_HIDDEN_VISIBILITY
46 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
47 extern int EnableABIBreakingChecks;
48 LLVM_HIDDEN_VISIBILITY
49 __attribute__((weak)) int *VerifyEnableABIBreakingChecks =
50 &EnableABIBreakingChecks;
52 extern int DisableABIBreakingChecks;
53 LLVM_HIDDEN_VISIBILITY
54 __attribute__((weak)) int *VerifyDisableABIBreakingChecks =
55 &DisableABIBreakingChecks;
58 #undef LLVM_HIDDEN_VISIBILITY
61 #endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING