1/*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/
2/* */
3/* The LLVM Compiler Infrastructure */
4/* */
5/* This file is distributed under the University of Illinois Open Source */
6/* License. See LICENSE.TXT for details. */
7/* */
8/*===----------------------------------------------------------------------===*/
9
10/* This file controls the C++ ABI break introduced in LLVM public header. */
11
12#ifndef LLVM_ABI_BREAKING_CHECKS_H
13#define LLVM_ABI_BREAKING_CHECKS_H
14
15/* Define to enable checks that alter the LLVM C++ ABI */
16#define LLVM_ENABLE_ABI_BREAKING_CHECKS 0
17
18/* Define to enable reverse iteration of unordered llvm containers */
19#define LLVM_ENABLE_REVERSE_ITERATION 0
20
21/* Allow selectively disabling link-time mismatch checking so that header-only
22 ADT content from LLVM can be used without linking libSupport. */
23#if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
24
25// ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
26// mismatch with LLVM
27#if defined(_MSC_VER)
28// Use pragma with MSVC
29#define LLVM_XSTR(s) LLVM_STR(s)
30#define LLVM_STR(s) #s
31#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
32#undef LLVM_XSTR
33#undef LLVM_STR
34#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
35// FIXME: Implement checks without weak.
36#elif defined(__cplusplus)
37namespace llvm {
38#if LLVM_ENABLE_ABI_BREAKING_CHECKS
39extern int EnableABIBreakingChecks;
40__attribute__((weak, visibility ("hidden"))) int *VerifyEnableABIBreakingChecks = &EnableABIBreakingChecks;
41#else
42extern int DisableABIBreakingChecks;
43__attribute__((weak, visibility ("hidden"))) int *VerifyDisableABIBreakingChecks = &DisableABIBreakingChecks;
44#endif
45}
46#endif // _MSC_VER
47
48#endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
49
50#endif
51