[Mlir-commits] [mlir] 2e02d2a - [mlir] Change ABI breaking use of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS in DebugActions.h

Markus Böck llvmlistbot at llvm.org
Wed Nov 3 11:03:10 PDT 2021


Author: Markus Böck
Date: 2021-11-03T19:03:04+01:00
New Revision: 2e02d2a62f3a86c105ea84323b38941c03ce37da

URL: https://github.com/llvm/llvm-project/commit/2e02d2a62f3a86c105ea84323b38941c03ce37da
DIFF: https://github.com/llvm/llvm-project/commit/2e02d2a62f3a86c105ea84323b38941c03ce37da.diff

LOG: [mlir] Change ABI breaking use of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS in DebugActions.h

A quick grep for NDEBUG in MLIR revealed a use in DebugActions.h that breaks ABI. This patch changes the use of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS which has the advantage of being independent of whether clients build their own app in debug or release as it is purely dependant on how MLIR itself was built.

Differential Revision: https://reviews.llvm.org/D113088

Added: 
    

Modified: 
    mlir/include/mlir/Support/DebugAction.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Support/DebugAction.h b/mlir/include/mlir/Support/DebugAction.h
index 352370cf48ce..74f0f4c47b22 100644
--- a/mlir/include/mlir/Support/DebugAction.h
+++ b/mlir/include/mlir/Support/DebugAction.h
@@ -90,7 +90,7 @@ class DebugActionManager {
   /// Register the given action handler with the manager.
   void registerActionHandler(std::unique_ptr<HandlerBase> handler) {
     // The manager is always disabled if built without debug.
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
     actionHandlers.emplace_back(std::move(handler));
 #endif
   }
@@ -109,7 +109,7 @@ class DebugActionManager {
   template <typename ActionType, typename... Args>
   bool shouldExecute(Args &&... args) {
     // The manager is always disabled if built without debug.
-#ifdef NDEBUG
+#if !LLVM_ENABLE_ABI_BREAKING_CHECKS
     return true;
 #else
     // Invoke the `shouldExecute` method on the provided handler.
@@ -127,7 +127,7 @@ class DebugActionManager {
 
 private:
 // The manager is always disabled if built without debug.
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
   //===--------------------------------------------------------------------===//
   // Query to Handler Dispatch
   //===--------------------------------------------------------------------===//


        


More information about the Mlir-commits mailing list