]> granicus.if.org Git - llvm/commitdiff
Use LLVM_ENABLE_ABI_BREAKING_CHECKS correctly
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 29 Sep 2017 17:17:54 +0000 (17:17 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 29 Sep 2017 17:17:54 +0000 (17:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314539 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopInfo.h

index 4d3da873ac55e166b8372a5ff650b96e447bf19d..06479bcbb98b0cee485528ca5f6e36cc19ddef47 100644 (file)
@@ -76,7 +76,7 @@ template <class BlockT, class LoopT> class LoopBase {
 
   SmallPtrSet<const BlockT *, 8> 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();