[flang-commits] [flang] [Flang] Add new CHECK_MSG() function (PR #86576)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Mon Mar 25 14:22:59 PDT 2024


================
@@ -87,6 +89,8 @@ template <typename... LAMBDAS> visitors(LAMBDAS... x) -> visitors<LAMBDAS...>;
 // To disable, compile with '-DCHECK=(void)'
 #ifndef CHECK
 #define CHECK(x) ((x) || (DIE("CHECK(" #x ") failed"), false))
+// Same as above, but with a custom error message.
+#define CHECK_MSG(x, y) ((x) || (DIE_MSG("CHECK(" #x ") failed: ", y), false))
----------------
klausler wrote:

`#define CHECK_MSG(x, y) ((x) || (DIE("CHECK(" #x ") failed: " #y), false))` avoids a need for `DIE_MSG`.

https://github.com/llvm/llvm-project/pull/86576


More information about the flang-commits mailing list