From d06dd61292ef6d1a80ce8794d913c5cd414e3e6b Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Fri, 29 Sep 2017 17:17:54 +0000 Subject: [PATCH] Use LLVM_ENABLE_ABI_BREAKING_CHECKS correctly llvm-svn: 314539 --- llvm/include/llvm/Analysis/LoopInfo.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h index 4d3da87..06479bc 100644 --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -76,7 +76,7 @@ template class LoopBase { SmallPtrSet DenseBlockSet; -#if !defined(NDEBUG) || !LLVM_ENABLE_ABI_BREAKING_CHECKS +#if LLVM_ENABLE_ABI_BREAKING_CHECKS /// Indicator that this loop is no longer a valid loop. bool IsInvalid = false; #endif @@ -165,15 +165,19 @@ public: return Blocks.size(); } -#ifndef NDEBUG /// Return true if this loop is no longer valid. The only valid use of this /// helper is "assert(L.isInvalid())" or equivalent, since IsInvalid is set to - /// false by the destructor. In other words, if this accessor returns false, + /// true by the destructor. In other words, if this accessor returns true, /// the caller has already triggered UB by calling this accessor; and so it - /// can only be called in a context where a return value of false indicates a + /// can only be called in a context where a return value of true indicates a /// programmer error. - bool isInvalid() const { return IsInvalid; } + bool isInvalid() const { +#if LLVM_ENABLE_ABI_BREAKING_CHECKS + return IsInvalid; +#else + return false; #endif + } /// True if terminator in the block can branch to another block that is /// outside of the current loop. @@ -392,7 +396,9 @@ protected: for (auto *SubLoop : SubLoops) SubLoop->~LoopT(); +#if LLVM_ENABLE_ABI_BREAKING_CHECKS IsInvalid = true; +#endif SubLoops.clear(); Blocks.clear(); DenseBlockSet.clear(); -- 2.7.4