From ece29ea90b4f49f8607e35ba54daed243931048f Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Fri, 30 Sep 2016 19:52:27 +0000 Subject: [PATCH] Turn LLVM_ENABLE_ABI_BREAKING_CHECKS into a 0/1 definition like LLVM_ENABLE_THREADS. Include llvm-config.h explicitly in headers to make sure that the definition is available. llvm-svn: 282907 --- llvm/include/llvm/ADT/EpochTracker.h | 32 ++++++++++++++-------------- llvm/include/llvm/ADT/ilist_node_options.h | 4 +++- llvm/include/llvm/Config/config.h.cmake | 5 ++--- llvm/include/llvm/Config/llvm-config.h.cmake | 5 ++--- llvm/unittests/ADT/IListSentinelTest.cpp | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/llvm/include/llvm/ADT/EpochTracker.h b/llvm/include/llvm/ADT/EpochTracker.h index 582d581..6710253 100644 --- a/llvm/include/llvm/ADT/EpochTracker.h +++ b/llvm/include/llvm/ADT/EpochTracker.h @@ -22,22 +22,7 @@ namespace llvm { -#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS - -class DebugEpochBase { -public: - void incrementEpoch() {} - - class HandleBase { - public: - HandleBase() = default; - explicit HandleBase(const DebugEpochBase *) {} - bool isHandleInSync() const { return true; } - const void *getEpochAddress() const { return nullptr; } - }; -}; - -#else +#if LLVM_ENABLE_ABI_BREAKING_CHECKS /// \brief A base class for data structure classes wishing to make iterators /// ("handles") pointing into themselves fail-fast. When building without @@ -92,6 +77,21 @@ public: }; }; +#else + +class DebugEpochBase { +public: + void incrementEpoch() {} + + class HandleBase { + public: + HandleBase() = default; + explicit HandleBase(const DebugEpochBase *) {} + bool isHandleInSync() const { return true; } + const void *getEpochAddress() const { return nullptr; } + }; +}; + #endif // LLVM_ENABLE_ABI_BREAKING_CHECKS } // namespace llvm diff --git a/llvm/include/llvm/ADT/ilist_node_options.h b/llvm/include/llvm/ADT/ilist_node_options.h index 4a44f92..6086a1f 100644 --- a/llvm/include/llvm/ADT/ilist_node_options.h +++ b/llvm/include/llvm/ADT/ilist_node_options.h @@ -10,6 +10,8 @@ #ifndef LLVM_ADT_ILIST_NODE_OPTIONS_H #define LLVM_ADT_ILIST_NODE_OPTIONS_H +#include "llvm/Config/llvm-config.h" + #include namespace llvm { @@ -64,7 +66,7 @@ struct extract_sentinel_tracking< template struct extract_sentinel_tracking : extract_sentinel_tracking {}; -#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS +#if LLVM_ENABLE_ABI_BREAKING_CHECKS template <> struct extract_sentinel_tracking<> : std::true_type, is_implicit {}; #else template <> diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index 0514022..d829d46 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -375,9 +375,8 @@ /* Installation directory for documentation */ #cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}" -/* Define if LLVM is built with asserts and checks that change the layout of - client-visible data structures. */ -#cmakedefine LLVM_ENABLE_ABI_BREAKING_CHECKS +/* Define to enable checks that alter the LLVM C++ ABI */ +#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS /* Define if threads enabled */ #cmakedefine01 LLVM_ENABLE_THREADS diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index eb5fbaa..b54ab1e 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -26,9 +26,8 @@ /* Installation directory for documentation */ #cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}" -/* Define if LLVM is built with asserts and checks that change the layout of - client-visible data structures. */ -#cmakedefine LLVM_ENABLE_ABI_BREAKING_CHECKS +/* Define to enable checks that alter the LLVM C++ ABI */ +#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS /* Define if threads enabled */ #cmakedefine01 LLVM_ENABLE_THREADS diff --git a/llvm/unittests/ADT/IListSentinelTest.cpp b/llvm/unittests/ADT/IListSentinelTest.cpp index a5e3656..bd60c90 100644 --- a/llvm/unittests/ADT/IListSentinelTest.cpp +++ b/llvm/unittests/ADT/IListSentinelTest.cpp @@ -37,7 +37,7 @@ TEST(IListSentinelTest, DefaultConstructor) { Sentinel S; EXPECT_EQ(&S, LocalAccess::getPrev(S)); EXPECT_EQ(&S, LocalAccess::getNext(S)); -#ifdef LLVM_ENABLE_ABI_BREAKING_CHECKS +#if LLVM_ENABLE_ABI_BREAKING_CHECKS EXPECT_TRUE(S.isKnownSentinel()); #else EXPECT_FALSE(S.isKnownSentinel()); -- 2.7.4