Skip to content

Conversation

@joker-eph
Copy link
Collaborator

Also, improve LDBG() to accept debug type and level in any order, and add unit-tests for LDBG() and LGDB_OS().

LDBG_OS() is a macro that behaves like LDBG() but instead of directly using it to stream the output, it takes a callback function that will be called with a raw_ostream.

@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2025

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-llvm-support

Author: Mehdi Amini (joker-eph)

Changes

Also, improve LDBG() to accept debug type and level in any order, and add unit-tests for LDBG() and LGDB_OS().

LDBG_OS() is a macro that behaves like LDBG() but instead of directly using it to stream the output, it takes a callback function that will be called with a raw_ostream.


Patch is 22.31 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/157194.diff

3 Files Affected:

  • (modified) llvm/include/llvm/Support/Debug.h (-5)
  • (modified) llvm/include/llvm/Support/DebugLog.h (+194-51)
  • (modified) llvm/unittests/Support/DebugLogTest.cpp (+127-2)
diff --git a/llvm/include/llvm/Support/Debug.h b/llvm/include/llvm/Support/Debug.h
index a7795d403721c..b73f2d7c8b852 100644
--- a/llvm/include/llvm/Support/Debug.h
+++ b/llvm/include/llvm/Support/Debug.h
@@ -44,11 +44,6 @@ class raw_ostream;
 /// level, return false.
 LLVM_ABI bool isCurrentDebugType(const char *Type, int Level = 0);
 
-/// Overload allowing to swap the order of the Type and Level arguments.
-LLVM_ABI inline bool isCurrentDebugType(int Level, const char *Type) {
-  return isCurrentDebugType(Type, Level);
-}
-
 /// setCurrentDebugType - Set the current debug type, as if the -debug-only=X
 /// option were specified.  Note that DebugFlag also needs to be set to true for
 /// debug output to be produced.
diff --git a/llvm/include/llvm/Support/DebugLog.h b/llvm/include/llvm/Support/DebugLog.h
index dce706e196bde..7963c38761ac1 100644
--- a/llvm/include/llvm/Support/DebugLog.h
+++ b/llvm/include/llvm/Support/DebugLog.h
@@ -19,52 +19,81 @@
 namespace llvm {
 #ifndef NDEBUG
 
-// LDBG() is a macro that can be used as a raw_ostream for debugging.
-// It will stream the output to the dbgs() stream, with a prefix of the
-// debug type and the file and line number. A trailing newline is added to the
-// output automatically. If the streamed content contains a newline, the prefix
-// is added to each beginning of a new line. Nothing is printed if the debug
-// output is not enabled or the debug type does not match.
-//
-// E.g.,
-//   LDBG() << "Bitset contains: " << Bitset;
-// is somehow equivalent to
-//   LLVM_DEBUG(dbgs() << "[" << DEBUG_TYPE << "] " << __FILE__ << ":" <<
-//   __LINE__ << " "
-//              << "Bitset contains: " << Bitset << "\n");
-//
+/// LDBG() is a macro that can be used as a raw_ostream for debugging.
+/// It will stream the output to the dbgs() stream, with a prefix of the
+/// debug type and the file and line number. A trailing newline is added to the
+/// output automatically. If the streamed content contains a newline, the prefix
+/// is added to each beginning of a new line. Nothing is printed if the debug
+/// output is not enabled or the debug type does not match.
+///
+/// E.g.,
+///   LDBG() << "Bitset contains: " << Bitset;
+/// is somehow equivalent to
+///   LLVM_DEBUG(dbgs() << "[" << DEBUG_TYPE << "] " << __FILE__ << ":" <<
+///   __LINE__ << " "
+///              << "Bitset contains: " << Bitset << "\n");
+///
 // An optional `level` argument can be provided to control the verbosity of the
-// output. The default level is 1, and is in increasing level of verbosity.
-//
-// The `level` argument can be a literal integer, or a macro that evaluates to
-// an integer.
-//
-// An optional `type` argument can be provided to control the debug type. The
-// default type is DEBUG_TYPE. The `type` argument can be a literal string, or a
-// macro that evaluates to a string.
+/// output. The default level is 1, and is in increasing level of verbosity.
+///
+/// The `level` argument can be a literal integer, or a macro that evaluates to
+/// an integer.
+///
+/// An optional `type` argument can be provided to control the debug type. The
+/// default type is DEBUG_TYPE. The `type` argument can be a literal string, or
+/// a macro that evaluates to a string.
+///
+/// E.g.,
+///   LDBG(2) << "Bitset contains: " << Bitset;
+///   LDBG("debug_type") << "Bitset contains: " << Bitset;
+///   LDBG(2, "debug_type") << "Bitset contains: " << Bitset;
+///   LDBG("debug_type", 2) << "Bitset contains: " << Bitset;
 #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)
 
-// Helper macros to choose the correct macro based on the number of arguments.
+/// LDBG_OS() is a macro that behaves like LDBG() but instead of directly using
+/// it to stream the output, it takes a callback function that will be called
+/// with a raw_ostream.
+/// This is useful when you need to pass a `raw_ostream` to a helper function to
+/// be able to print (when the `<<` operator is not available).
+///
+/// E.g.,
+///   LDBG_OS([&] (raw_ostream &Os) {
+///     Os << "Pass Manager contains: ";
+///     pm.printAsTextual(Os);
+///   });
+///
+/// Just like LDBG(), it optionally accepts a `level` and `type` arguments.
+/// E.g.,
+///   LDBG_OS(2, [&] (raw_ostream &Os) { ... });
+///   LDBG_OS("debug_type", [&] (raw_ostream &Os) { ... });
+///   LDBG_OS(2, "debug_type", [&] (raw_ostream &Os) { ... });
+///   LDBG_OS("debug_type", 2, [&] (raw_ostream &Os) { ... });
+///
+#define LDBG_OS(...) _GET_LDBG_OS_MACRO(__VA_ARGS__)(__VA_ARGS__)
+
+// Helper macros to choose the correct LDBG() macro based on the number of
+// arguments.
 #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
 #define LDBG_FUNC_RECOMPOSER(argsWithParentheses)                              \
   LDBG_FUNC_CHOOSER argsWithParentheses
 #define LDBG_CHOOSE_FROM_ARG_COUNT(...)                                        \
   LDBG_FUNC_RECOMPOSER(                                                        \
-      (__VA_ARGS__, LDBG_LOG_LEVEL_WITH_TYPE, LDBG_LOG_LEVEL, ))
-#define LDBG_NO_ARG_EXPANDER() , , LDBG_LOG_LEVEL_1
+      (__VA_ARGS__, LDBG_LOG_LEVEL_WITH_TYPE, LDBG_LOG_LEVEL_1_ARG, ))
+#define LDBG_NO_ARG_EXPANDER() , , LDBG_LOG_LEVEL_NO_ARG
 #define _GET_LDBG_MACRO(...)                                                   \
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
 
-// Dispatch macros to support the `level` argument or none (default to 1)
-#define LDBG_LOG_LEVEL(LEVEL)                                                  \
-  DEBUGLOG_WITH_STREAM_AND_TYPE(llvm::dbgs(), LEVEL, DEBUG_TYPE)
-#define LDBG_LOG_LEVEL_1() LDBG_LOG_LEVEL(1)
-// This macro is a helper when LDBG() is called with 2 arguments.
-// In this case we want to allow the order of the arguments to be swapped.
-// We rely on the fact that the `level` argument is an integer, and the `type`
-// is a string and dispatch to a C++ API that is overloaded.
-#define LDBG_LOG_LEVEL_WITH_TYPE(LEVEL_OR_TYPE, TYPE_OR_LEVEL)                 \
-  DEBUGLOG_WITH_STREAM_AND_TYPE(llvm::dbgs(), (LEVEL_OR_TYPE), (TYPE_OR_LEVEL))
+// Helper macros to choose the correct LDBG_OS() macro based on the number of
+// arguments.
+#define LDBG_OS_FUNC_CHOOSER(_f1, _f2, _f3, _f4, ...) _f4
+#define LDBG_OS_FUNC_RECOMPOSER(argsWithParentheses)                           \
+  LDBG_OS_FUNC_CHOOSER argsWithParentheses
+#define LDBG_OS_CHOOSE_FROM_ARG_COUNT(...)                                     \
+  LDBG_OS_FUNC_RECOMPOSER(                                                     \
+      (__VA_ARGS__, LDBG_OS_3_ARGS, LDBG_OS_2_ARGS, LDBG_OS_1_ARG, ))
+#define LDBG_OS_NO_ARG_EXPANDER() , , , LDBG_OS_1_ARG
+#define _GET_LDBG_OS_MACRO(...)                                                \
+  LDBG_OS_CHOOSE_FROM_ARG_COUNT(LDBG_OS_NO_ARG_EXPANDER __VA_ARGS__())
 
 // We want the filename without the full path. We are using the __FILE__ macro
 // and a constexpr function to strip the path prefix. We can avoid the frontend
@@ -76,22 +105,129 @@ namespace llvm {
 #define __LLVM_FILE_NAME__ ::llvm::impl::getShortFileName(__FILE__)
 #endif
 
-#define DEBUGLOG_WITH_STREAM_TYPE_FILE_AND_LINE(STREAM, LEVEL, TYPE, FILE,     \
-                                                LINE)                          \
-  for (bool _c =                                                               \
-           (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE, LEVEL));     \
+/// These macros are detecting if the DEBUG_TYPE or LDBG_DEBUG_STREAM macros are
+/// defined. They are using a combination of preprocessor tricks and C++17
+// used-defined string literals to achieve this.
+// For example, if DEBUG_TYPE is defined to "foo", the preprocessor will expand
+// the macro and then stringify the result to
+//  "foo"_LDBG_VARIABLE_CHECK
+// This dispatch to the user-defined string literal operator named
+// _LDBG_VARIABLE_CHECK which returns true. Otherwise it expands to
+// DEBUG_TYPE_LDBG_VARIABLE_CHECK which we define as a macro that returns false.
+#define LDBG_VARIABLE_CHECK_(VARIABLE, ...) VARIABLE##__VA_ARGS__
+#define LDBG_VARIABLE_CHECK(VARIABLE)                                          \
+  LDBG_VARIABLE_CHECK_(VARIABLE, _LDBG_VARIABLE_CHECK)
+// User-defined string literal operator for the LDBG_VARIABLE_CHECK macro.
+constexpr bool operator""_LDBG_VARIABLE_CHECK(const char *, std::size_t) {
+  return true;
+}
+
+#define IS_DEBUG_TYPE_DEFINED() LDBG_VARIABLE_CHECK(DEBUG_TYPE)
+#define DEBUG_TYPE_LDBG_VARIABLE_CHECK 0
+
+#define IS_LDBG_DEBUG_STREAM_DEFINED() LDBG_VARIABLE_CHECK(LDBG_DEBUG_STREAM)
+#define LDBG_DEBUG_STREAM_LDBG_VARIABLE_CHECK 0
+
+/// Helpers to get DEBUG_TYPE as a string literal, even when DEBUG_TYPE is not
+/// defined (in which case it expand to "DEBUG_TYPE")
+#define LDBG_GET_DEBUG_TYPE_STR__(X) #X##_LDBG_DEBUG_STRING
+#define LDBG_GET_DEBUG_TYPE_STR_(X) LDBG_GET_DEBUG_TYPE_STR__(X)
+#define LDBG_GET_DEBUG_TYPE_STR() LDBG_GET_DEBUG_TYPE_STR_(DEBUG_TYPE)
+/// If DEBUG_TYPE is defined, we get the string with the quotes, we need to
+/// remove them here.
+constexpr ::llvm::StringRef operator""_LDBG_DEBUG_STRING(const char *Str,
+                                                         std::size_t) {
+  ::llvm::StringRef S(Str);
+  if (S.front() == '"' && S.back() == '"')
+    return S.drop_front().drop_back();
+  return S;
+}
+
+/// Helper to provide the default level (=1) or type (=DEBUG_TYPE). This is used
+/// when a single argument is passed, if it is an integer we return DEBUG_TYPE
+/// and if it is a string we return 1. This fails with a static_assert if we
+/// pass an integer and DEBUG_TYPE is not defined.
+#define LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE)                          \
+  [](auto LevelOrType) {                                                       \
+    if constexpr (std::is_integral_v<decltype(LevelOrType)>) {                 \
+      using ::llvm::operator""_LDBG_VARIABLE_CHECK;                            \
+      using ::llvm::operator""_LDBG_DEBUG_STRING;                              \
+      if constexpr (IS_DEBUG_TYPE_DEFINED())                                   \
+        return LDBG_GET_DEBUG_TYPE_STR();                                      \
+      else                                                                     \
+        static_assert(false, "DEBUG_TYPE is not defined");                     \
+    } else {                                                                   \
+      return 1;                                                                \
+    }                                                                          \
+  }(LEVEL_OR_TYPE)
+
+/// Use a macro to allow unit-testing to override.
+#define LDBG_STREAM ::llvm::dbgs()
+
+#define DEBUGLOG_WITH_STREAM_TYPE_FILE_AND_LINE(STREAM, LEVEL_OR_TYPE,         \
+                                                TYPE_OR_LEVEL, FILE, LINE)     \
+  for (bool _c = (::llvm::DebugFlag && ::llvm::impl::ldbgIsCurrentDebugType(   \
+                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE));     \
        _c; _c = false)                                                         \
     for (::llvm::impl::raw_ldbg_ostream LdbgOS{                                \
-             ::llvm::impl::computePrefix(TYPE, FILE, LINE, LEVEL), (STREAM)};  \
+             ::llvm::impl::computePrefix(TYPE_OR_LEVEL, FILE, LINE,            \
+                                         LEVEL_OR_TYPE),                       \
+             (STREAM), /*ShouldPrefixNextString=*/true,                        \
+             /*ShouldEmitNewLineOnDestruction=*/true};                         \
          _c; _c = false)                                                       \
-  ::llvm::impl::RAIINewLineStream{LdbgOS}.asLvalue()
+  LdbgOS
 
-#define DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, LEVEL, TYPE, FILE)          \
-  DEBUGLOG_WITH_STREAM_TYPE_FILE_AND_LINE(STREAM, LEVEL, TYPE, FILE, __LINE__)
-#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, LEVEL, TYPE)                     \
-  DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, LEVEL, TYPE, __LLVM_FILE_NAME__)
+#define DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE,              \
+                                           TYPE_OR_LEVEL, FILE)                \
+  DEBUGLOG_WITH_STREAM_TYPE_FILE_AND_LINE(STREAM, LEVEL_OR_TYPE,               \
+                                          TYPE_OR_LEVEL, FILE, __LINE__)
+#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL)    \
+  DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,     \
+                                     __LLVM_FILE_NAME__)
+
+// Dispatch macros when a signle argument is provided. This can be either a
+// level of the debug type.
+#define LDBG_LOG_LEVEL_1_ARG(LEVEL_OR_TYPE)                                    \
+  DEBUGLOG_WITH_STREAM_AND_TYPE(LDBG_STREAM, LEVEL_OR_TYPE,                    \
+                                LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
+#define LDBG_LOG_LEVEL_NO_ARG() LDBG_LOG_LEVEL_1_ARG(1)
+// This macro is a helper when LDBG() is called with 2 arguments.
+// In this case we want to allow the order of the arguments to be swapped.
+// We rely on the fact that the `level` argument is an integer, and the `type`
+// is a string and dispatch to a C++ API that is overloaded.
+#define LDBG_LOG_LEVEL_WITH_TYPE(LEVEL_OR_TYPE, TYPE_OR_LEVEL)                 \
+  DEBUGLOG_WITH_STREAM_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE), (TYPE_OR_LEVEL))
+
+#define LDBG_OS_IMPL(TYPE_OR_LEVEL, LEVEL_OR_TYPE, CALLBACK, STREAM, FILE,     \
+                     LINE)                                                     \
+  if (::llvm::DebugFlag &&                                                     \
+      ::llvm::impl::ldbgIsCurrentDebugType(TYPE_OR_LEVEL, LEVEL_OR_TYPE)) {    \
+    ::llvm::impl::raw_ldbg_ostream LdbgOS{                                     \
+        ::llvm::impl::computePrefix(TYPE_OR_LEVEL, FILE, LINE, LEVEL_OR_TYPE), \
+        (STREAM), /*ShouldPrefixNextString=*/true,                             \
+        /*ShouldEmitNewLineOnDestruction=*/true};                              \
+    CALLBACK(LdbgOS);                                                          \
+  }
+
+#define LDBG_OS_3_ARGS(TYPE_OR_LEVEL, LEVEL_OR_TYPE, CALLBACK)                 \
+  LDBG_OS_IMPL(TYPE_OR_LEVEL, LEVEL_OR_TYPE, CALLBACK, LDBG_STREAM,            \
+               __LLVM_FILE_NAME__, __LINE__)
+
+#define LDBG_OS_2_ARGS(LEVEL_OR_TYPE, CALLBACK)                                \
+  LDBG_OS_3_ARGS(LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE), LEVEL_OR_TYPE, \
+                 CALLBACK)
+#define LDBG_OS_1_ARG(CALLBACK) LDBG_OS_2_ARGS(1, CALLBACK)
 
 namespace impl {
+/// Helper to call isCurrentDebugType with a StringRef.
+static LLVM_ATTRIBUTE_UNUSED bool ldbgIsCurrentDebugType(StringRef Type,
+                                                         int Level) {
+  return ::llvm::isCurrentDebugType(Type.str().c_str(), Level);
+}
+static LLVM_ATTRIBUTE_UNUSED bool ldbgIsCurrentDebugType(int Level,
+                                                         StringRef Type) {
+  return ::llvm::isCurrentDebugType(Type.str().c_str(), Level);
+}
 
 /// A raw_ostream that tracks `\n` and print the prefix after each
 /// newline.
@@ -99,6 +235,7 @@ class LLVM_ABI raw_ldbg_ostream final : public raw_ostream {
   std::string Prefix;
   raw_ostream &Os;
   bool ShouldPrefixNextString;
+  bool ShouldEmitNewLineOnDestruction;
 
   /// Split the line on newlines and insert the prefix before each
   /// newline. Forward everything to the underlying stream.
@@ -131,12 +268,17 @@ class LLVM_ABI raw_ldbg_ostream final : public raw_ostream {
 
 public:
   explicit raw_ldbg_ostream(std::string Prefix, raw_ostream &Os,
-                            bool ShouldPrefixNextString = true)
+                            bool ShouldPrefixNextString = true,
+                            bool ShouldEmitNewLineOnDestruction = false)
       : Prefix(std::move(Prefix)), Os(Os),
-        ShouldPrefixNextString(ShouldPrefixNextString) {
+        ShouldPrefixNextString(ShouldPrefixNextString),
+        ShouldEmitNewLineOnDestruction(ShouldEmitNewLineOnDestruction) {
     SetUnbuffered();
   }
-  ~raw_ldbg_ostream() final {}
+  ~raw_ldbg_ostream() final {
+    if (ShouldEmitNewLineOnDestruction)
+      Os << '\n';
+  }
 
   /// Forward the current_pos method to the underlying stream.
   uint64_t current_pos() const final { return Os.tell(); }
@@ -173,17 +315,17 @@ getShortFileName(const char *path) {
 /// "[DebugType] File:Line "
 /// Where the File is the file name without the path prefix.
 static LLVM_ATTRIBUTE_UNUSED std::string
-computePrefix(const char *DebugType, const char *File, int Line, int Level) {
+computePrefix(StringRef DebugType, const char *File, int Line, int Level) {
   std::string Prefix;
   raw_string_ostream OsPrefix(Prefix);
-  if (DebugType)
+  if (!DebugType.empty())
     OsPrefix << "[" << DebugType << ":" << Level << "] ";
   OsPrefix << File << ":" << Line << " ";
   return OsPrefix.str();
 }
 /// Overload allowing to swap the order of the DebugType and Level arguments.
 static LLVM_ATTRIBUTE_UNUSED std::string
-computePrefix(int Level, const char *File, int Line, const char *DebugType) {
+computePrefix(int Level, const char *File, int Line, StringRef DebugType) {
   return computePrefix(DebugType, File, Line, Level);
 }
 
@@ -194,6 +336,7 @@ computePrefix(int Level, const char *File, int Line, const char *DebugType) {
 #define LDBG(...)                                                              \
   for (bool _c = false; _c; _c = false)                                        \
   ::llvm::nulls()
+#define LDBG_OS(...)
 #endif
 } // end namespace llvm
 
diff --git a/llvm/unittests/Support/DebugLogTest.cpp b/llvm/unittests/Support/DebugLogTest.cpp
index e087705b72586..62b269dc5b3e4 100644
--- a/llvm/unittests/Support/DebugLogTest.cpp
+++ b/llvm/unittests/Support/DebugLogTest.cpp
@@ -27,7 +27,7 @@ TEST(DebugLogTest, Basic) {
   {
     std::string str;
     raw_string_ostream os(str);
-    DEBUGLOG_WITH_STREAM_AND_TYPE(os, 0, nullptr) << "NoType";
+    DEBUGLOG_WITH_STREAM_AND_TYPE(os, "", 0) << "NoType";
     EXPECT_FALSE(StringRef(os.str()).starts_with('['));
     EXPECT_TRUE(StringRef(os.str()).ends_with("NoType\n"));
   }
@@ -37,7 +37,7 @@ TEST(DebugLogTest, Basic) {
     std::string str;
     raw_string_ostream os(str);
     DEBUGLOG_WITH_STREAM_AND_TYPE(os, 0, "A") << "A";
-    DEBUGLOG_WITH_STREAM_AND_TYPE(os, 0, "B") << "B";
+    DEBUGLOG_WITH_STREAM_AND_TYPE(os, "B", 0) << "B";
     EXPECT_TRUE(StringRef(os.str()).starts_with('['));
     EXPECT_THAT(os.str(), AllOf(HasSubstr("A\n"), HasSubstr("B\n")));
   }
@@ -128,6 +128,131 @@ TEST(DebugLogTest, DestructorPrefix) {
   // After destructors, nothing should have been printed.
   EXPECT_EQ(os.str(), "");
 }
+
+TEST(DebugLogTest, LDBG_MACROS) {
+  llvm::DebugFlag = true;
+  static const char *DT[] = {"A:3", "B:2"};
+  setCurrentDebugTypes(DT, sizeof(DT) / sizeof(DT[0]));
+  std::string Str;
+  raw_string_ostream DebugOs(Str);
+  std::string StrRef;
+  raw_string_ostream RefOs(StrRef);
+#undef LDBG_STREAM
+#define LDBG_STREAM DebugOs
+#define DEBUG_TYPE "A"
+  LDBG() << "Hello, world!";
+  RefOs << "[A:1] " << __LLVM_FILE_NAME__ << ":" << (__LINE__ - 1)
+        << " Hello, world!\n";
+  EXPECT_EQ(DebugOs.str(), RefOs.str());
+  Str.clear();
+  StrRef.clear();
+
+  // Test with a level, no type.
+  LDBG(2) << "Hello, world!";
+  RefOs << "[A:2] " << __LLVM_FILE_NAME__ << ":" << (__LINE__ - 1)
+        << " Hello, world!\n";
+  EXPECT_EQ(DebugOs.str(), RefOs.str());
+  Str.clear();
+  StrRef.clear();
+
+// Now the type will be explicit, check we don't use DEBUG_TYPE.
+#undef DEBUG_TYPE
+
+  // Test with a type
+  LDBG("B") << "Hello, world!";
+  RefOs << "[B:1] " << __LLVM_FILE_NAME__ << ":" << (__LINE__ - 1)
+        << " Hello, world!\n";
+  EXPECT_EQ(DebugOs.str(), RefOs.str());
+  Str.clear();
+  StrRef.clear();
+
+  // Test with a level and a type
+  LDBG(2, "B") << "Hello, world!";
+  RefOs << "[B:2] " << __LLVM_FILE_NAME__ << ":" << (__LINE__ - 1)
+        << " Hello, world!\n";
+  EXPECT_EQ(DebugOs.str(), RefOs.str());
+  Str.clear();
+  StrRef.clear();
+
+  // Test with a type and a level
+  LDBG("B", 2) << "Hello, world!";
+  RefOs << "[B:2] " << __LLVM_FILE_NAME__ << ":" << (__LINE__ - 1)
+        << " Hello, world!\n";
+  EXPECT_EQ(DebugOs.str(), RefOs.str());
+  Str.clear();...
[truncated]

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like how you refactored LDBG_OS not to require LLVM_DEBUG and to be more consistent with LDBG 🙏🏻

This change is actually quite dense and not something I contribute to, so it took me a while to parse. Mostly make sense - I've left some minor suggestion. I will do another pass once these are addressed.

Thanks! In particular the unit tests will be a great source of documentation.

@joker-eph joker-eph force-pushed the ldbg_os branch 3 times, most recently from d25e088 to e582c36 Compare September 8, 2025 17:31
Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

I've left a few minor suggestions. I would also be good to somehow group+document the macros defined towards the end (see my comment inline).

Otherwise LG!

@github-actions
Copy link

github-actions bot commented Sep 9, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@joker-eph
Copy link
Collaborator Author

@banach-space : I revamped the grouping, now I start with a section:

// ----------------------------------------------------------------------------
// LDBG() implementation
// ----------------------------------------------------------------------------

where I also ensure that all the macros are prefixed with LDBG_ now and the suffixes matches with the LDBG_OS_ impl.

Then there is the section for:

// ----------------------------------------------------------------------------
// LDBG_OS() implementation
// ----------------------------------------------------------------------------

Modeled around the first section for LDBG() implementation.

And finally a section with:

// ----------------------------------------------------------------------------
// General Helpers for the implementation above
// ----------------------------------------------------------------------------

PTAL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How important is this change? (E.g, StringRef vs const char*)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's needed because of the auto-detection for DEBUG_TYPE mean that we get a literal that is:

"\"my-debug-type\"" and we use a StringRef in operator""_LDBG_DEBUG_STRING to remove the extra surrounding double quotes.
If someone knows a better macro expansion, I'm interested, but it took me 2h to come up with these tricks :)

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for addressing my comments!

Please wait for @jpienaar to approve before landing.

@joker-eph
Copy link
Collaborator Author

Working with @math-fehr and iterating on the implementation, I managed to simplify if further in this last push: https://github.com/llvm/llvm-project/compare/13b70c3611f1bc49191698c8ddd52a74c81f5201..8b8b41a5157645de0addc70869e2d5d8e5a9cb57

Copy link
Member

@jpienaar jpienaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

Also, improve LDBG() to accept debug type and level in any order,
and add unit-tests for LDBG() and LGDB_OS().

LDBG_OS() is a macro that behaves like LDBG() but instead of directly using
it to stream the output, it takes a callback function that will be called
with a raw_ostream.

Co-authored-by: Andrzej Warzyński <[email protected]>
@joker-eph joker-eph merged commit c84f34b into llvm:main Sep 11, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building llvm,mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/21732

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[3666/8061] Creating library symlink lib/libLLVMHipStdPar.so
[3667/8061] Creating library symlink lib/libLLVMFrontendDriver.so
[3668/8061] Linking CXX shared library lib/libLLVMLinker.so.22.0git
[3669/8061] Creating library symlink lib/libLLVMLinker.so
[3670/8061] Building CXX object tools/mlir/lib/Remark/CMakeFiles/obj.MLIRRemarkStreamer.dir/RemarkStreamer.cpp.o
[3671/8061] Building CXX object tools/mlir/lib/Debug/CMakeFiles/obj.MLIRDebug.dir/DebugCounter.cpp.o
[3672/8061] Building CXX object tools/mlir/lib/Tools/lsp-server-support/CMakeFiles/obj.MLIRLspServerSupportLib.dir/CompilationDatabase.cpp.o
[3673/8061] Linking CXX shared library lib/libLLVMScalarOpts.so.22.0git
[3674/8061] Creating library symlink lib/libLLVMScalarOpts.so
[3675/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o
FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -MF tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o.d -o tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR/Dialect.cpp
In file included from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR/Dialect.cpp:22:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR/Dialect.cpp: In lambda function:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
         static_assert(false, "DEBUG_TYPE is not defined");                     \
                       ^~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
                                           ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
 #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
                       ^~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
 #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
                                               ^~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   LDBG_FUNC_CHOOSER argsWithParentheses
   ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
 #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)
Step 7 (build cmake config) failure: build cmake config (failure)
...
[3666/8061] Creating library symlink lib/libLLVMHipStdPar.so
[3667/8061] Creating library symlink lib/libLLVMFrontendDriver.so
[3668/8061] Linking CXX shared library lib/libLLVMLinker.so.22.0git
[3669/8061] Creating library symlink lib/libLLVMLinker.so
[3670/8061] Building CXX object tools/mlir/lib/Remark/CMakeFiles/obj.MLIRRemarkStreamer.dir/RemarkStreamer.cpp.o
[3671/8061] Building CXX object tools/mlir/lib/Debug/CMakeFiles/obj.MLIRDebug.dir/DebugCounter.cpp.o
[3672/8061] Building CXX object tools/mlir/lib/Tools/lsp-server-support/CMakeFiles/obj.MLIRLspServerSupportLib.dir/CompilationDatabase.cpp.o
[3673/8061] Linking CXX shared library lib/libLLVMScalarOpts.so.22.0git
[3674/8061] Creating library symlink lib/libLLVMScalarOpts.so
[3675/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o
FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -MF tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o.d -o tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR/Dialect.cpp
In file included from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR/Dialect.cpp:22:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/IR/Dialect.cpp: In lambda function:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
         static_assert(false, "DEBUG_TYPE is not defined");                     \
                       ^~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
                                           ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
 #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
                       ^~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
 #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
                                               ^~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   LDBG_FUNC_CHOOSER argsWithParentheses
   ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
 #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building llvm,mlir at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/30535

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
171.048 [3850/32/3520] Linking CXX static library lib/libMLIRSupport.a
171.052 [3849/32/3521] Generating VCSVersion.inc
171.139 [3848/32/3522] Linking CXX executable bin/mlir-src-sharder
171.598 [3847/32/3523] Building CXX object tools/mlir/lib/Debug/CMakeFiles/obj.MLIRDebug.dir/DebugCounter.cpp.o
171.729 [3846/32/3524] Building CXX object tools/mlir/lib/Tools/lsp-server-support/CMakeFiles/obj.MLIRLspServerSupportLib.dir/CompilationDatabase.cpp.o
171.783 [3845/32/3525] Building CXX object tools/lld/Common/CMakeFiles/lldCommon.dir/CommonLinkerContext.cpp.o
171.816 [3844/32/3526] Building CXX object tools/mlir/lib/Tools/lsp-server-support/CMakeFiles/obj.MLIRLspServerSupportLib.dir/SourceMgrUtils.cpp.o
171.822 [3843/32/3527] Building CXX object tools/lld/Common/CMakeFiles/lldCommon.dir/Args.cpp.o
171.855 [3842/32/3528] Building CXX object tools/mlir/lib/Remark/CMakeFiles/obj.MLIRRemarkStreamer.dir/RemarkStreamer.cpp.o
172.000 [3841/32/3529] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o
FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/mlir/lib/IR -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/IR -Itools/mlir/include -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/include -Iinclude -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -MF tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o.d -o tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -c /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/IR/Dialect.cpp
In file included from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/IR/Dialect.cpp:22:0:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/IR/Dialect.cpp: In lambda function:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:210:9: error: static assertion failed: DEBUG_TYPE is not defined
         static_assert(false, "DEBUG_TYPE is not defined");                     \
         ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
                                           ^~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
 #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
                       ^~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
 #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
                                               ^~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   LDBG_FUNC_CHOOSER argsWithParentheses
   ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
 #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building llvm,mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/22920

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[3922/8061] Building CXX object tools/mlir/lib/Dialect/CMakeFiles/obj.MLIRDialect.dir/Traits.cpp.o
[3923/8061] Building CXX object tools/lld/MachO/CMakeFiles/lldMachO.dir/BPSectionOrderer.cpp.o
[3924/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinDialect.cpp.o
[3925/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinDialectBytecode.cpp.o
[3926/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinTypeInterfaces.cpp.o
[3927/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Diagnostics.cpp.o
[3928/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinTypes.cpp.o
[3929/8061] Building CXX object tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRControlFlowInterfaces.dir/ControlFlowInterfaces.cpp.o
[3930/8061] Building CXX object tools/lld/MachO/CMakeFiles/lldMachO.dir/DriverUtils.cpp.o
[3931/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o
FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o -MF tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o.d -o tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR/AsmPrinter.cpp
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR/AsmPrinter.cpp:43:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR/AsmPrinter.cpp: In lambda function:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
  210 |         static_assert(false, "DEBUG_TYPE is not defined");                     \
      |                       ^~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
  109 |                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
      |                                           ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
  124 |   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
  139 |   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
  140 |                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
  141 | #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
      |                       ^~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
   95 | #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
      |                                               ^~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   97 |   LDBG_FUNC_CHOOSER argsWithParentheses
      |   ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   99 |   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
      |   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
   50 | #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)
Step 7 (build cmake config) failure: build cmake config (failure)
...
[3922/8061] Building CXX object tools/mlir/lib/Dialect/CMakeFiles/obj.MLIRDialect.dir/Traits.cpp.o
[3923/8061] Building CXX object tools/lld/MachO/CMakeFiles/lldMachO.dir/BPSectionOrderer.cpp.o
[3924/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinDialect.cpp.o
[3925/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinDialectBytecode.cpp.o
[3926/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinTypeInterfaces.cpp.o
[3927/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Diagnostics.cpp.o
[3928/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/BuiltinTypes.cpp.o
[3929/8061] Building CXX object tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRControlFlowInterfaces.dir/ControlFlowInterfaces.cpp.o
[3930/8061] Building CXX object tools/lld/MachO/CMakeFiles/lldMachO.dir/DriverUtils.cpp.o
[3931/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o
FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o -MF tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o.d -o tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/AsmPrinter.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR/AsmPrinter.cpp
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR/AsmPrinter.cpp:43:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/IR/AsmPrinter.cpp: In lambda function:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
  210 |         static_assert(false, "DEBUG_TYPE is not defined");                     \
      |                       ^~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
  109 |                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
      |                                           ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
  124 |   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
  139 |   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
  140 |                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
  141 | #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
      |                       ^~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
   95 | #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
      |                                               ^~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   97 |   LDBG_FUNC_CHOOSER argsWithParentheses
      |   ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   99 |   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
      |   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
   50 | #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building llvm,mlir at step 8 "Add check check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/13288

Here is the relevant piece of the build log for the reference
Step 8 (Add check check-llvm) failure: test (failure)
...
[462/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MathExtrasTest.cpp.o
[463/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryBufferRefTest.cpp.o
[464/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugTest.cpp.o
[465/731] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/DebugInfoTest.cpp.o
[466/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugCounterTest.cpp.o
[467/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ModRefTest.cpp.o
[468/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CSKYAttributeParserTest.cpp.o
[469/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/NativeFormatTests.cpp.o
[470/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/OptimizedStructLayoutTest.cpp.o
[471/731] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/unittests/Support -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/third-party/unittest/googletest/include -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o -c /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support/DebugLogTest.cpp
In file included from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support/DebugLogTest.cpp:9:
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support/DebugLogTest.cpp: In lambda function:
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
  210 |         static_assert(false, "DEBUG_TYPE is not defined");                     \
      |                       ^~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
  109 |                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
      |                                           ^~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
  124 |   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
  139 |   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
  140 |                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
  141 | #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
      |                       ^~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
   95 | #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
      |                                               ^~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   97 |   LDBG_FUNC_CHOOSER argsWithParentheses
      |   ^~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   99 |   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
      |   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
   50 | #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building llvm,mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/21709

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[3939/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Remarks.cpp.o
[3940/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/SymbolTable.cpp.o
[3941/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/TensorEncoding.cpp.o
[3942/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Types.cpp.o
[3943/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/TypeRange.cpp.o
[3944/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/TypeUtilities.cpp.o
[3945/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Unit.cpp.o
[3946/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Value.cpp.o
[3947/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/ValueRange.cpp.o
[3948/8061] Building CXX object tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o
FAILED: tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/lib/Bytecode/Writer -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o -MF tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o.d -o tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
In file included from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp:22:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp: In lambda function:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
  210 |         static_assert(false, "DEBUG_TYPE is not defined");                     \
      |                       ^~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
  109 |                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
      |                                           ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
  124 |   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
  139 |   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
  140 |                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
  141 | #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
      |                       ^~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
   95 | #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
      |                                               ^~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   97 |   LDBG_FUNC_CHOOSER argsWithParentheses
      |   ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   99 |   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
      |   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
   50 | #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)
Step 7 (build cmake config) failure: build cmake config (failure)
...
[3939/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Remarks.cpp.o
[3940/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/SymbolTable.cpp.o
[3941/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/TensorEncoding.cpp.o
[3942/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Types.cpp.o
[3943/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/TypeRange.cpp.o
[3944/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/TypeUtilities.cpp.o
[3945/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Unit.cpp.o
[3946/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Value.cpp.o
[3947/8061] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/ValueRange.cpp.o
[3948/8061] Building CXX object tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o
FAILED: tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/lib/Bytecode/Writer -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o -MF tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o.d -o tools/mlir/lib/Bytecode/Writer/CMakeFiles/obj.MLIRBytecodeWriter.dir/BytecodeWriter.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
In file included from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp:22:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp: In lambda function:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
  210 |         static_assert(false, "DEBUG_TYPE is not defined");                     \
      |                       ^~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
  109 |                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
      |                                           ^~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
  124 |   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
  139 |   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
  140 |                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
  141 | #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
      |                       ^~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
   95 | #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
      |                                               ^~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   97 |   LDBG_FUNC_CHOOSER argsWithParentheses
      |   ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   99 |   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
      |   ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |                              ^~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
   50 | #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder mlir-nvidia-gcc7 running on mlir-nvidia while building llvm,mlir at step 6 "build-check-mlir-build-only".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/18197

Here is the relevant piece of the build log for the reference
Step 6 (build-check-mlir-build-only) failure: build (failure)
...
974.722 [1910/16/3043] Building CXX object tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferIntRangeInterface.dir/InferIntRangeInterface.cpp.o
974.747 [1909/16/3044] Building CXX object tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferTypeOpInterface.dir/InferTypeOpInterface.cpp.o
974.771 [1908/16/3045] Building CXX object tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRLoopLikeInterface.dir/LoopLikeInterface.cpp.o
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Interfaces/LoopLikeInterface.cpp: In static member function ‘static bool mlir::LoopLikeOpInterface::blockIsInLoop(mlir::Block*)’:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/Interfaces/LoopLikeInterface.cpp:40:23: warning: unused variable ‘it’ [-Wunused-variable]
     auto [it, inserted] = visited.insert(current);
                       ^
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
975.224 [1907/16/3046] Building CXX object tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o
FAILED: tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/g++-7 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/tools/mlir/lib/IR -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/IR -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/tools/mlir/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/include -I/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -MF tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o.d -o tools/mlir/lib/IR/CMakeFiles/obj.MLIRIR.dir/Dialect.cpp.o -c /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/IR/Dialect.cpp
In file included from /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/IR/Dialect.cpp:22:0:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/lib/IR/Dialect.cpp: In lambda function:
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:210:9: error: static assertion failed: DEBUG_TYPE is not defined
         static_assert(false, "DEBUG_TYPE is not defined");                     \
         ^
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
                                           ^~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
 #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
                       ^~~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
 #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
                                               ^~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   LDBG_FUNC_CHOOSER argsWithParentheses
   ^~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
   ^~~~~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
                              ^~~~~~~~~~~~~~~~~~~~
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
 #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building llvm,mlir at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/27244

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
1173.326 [459/8/5768] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DivisionByConstantTest.cpp.o
1173.339 [458/8/5769] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DJBTest.cpp.o
1173.351 [457/8/5770] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/EndianStreamTest.cpp.o
1173.364 [456/8/5771] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/EndianTest.cpp.o
1173.541 [455/8/5772] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CSKYAttributeParserTest.cpp.o
1173.553 [454/8/5773] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ErrnoTest.cpp.o
1173.565 [453/8/5774] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ErrorOrTest.cpp.o
1173.759 [452/8/5775] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugCounterTest.cpp.o
1173.914 [451/8/5776] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugTest.cpp.o
1173.921 [450/8/5777] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o
FAILED: [code=1] unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /opt/homebrew/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/buildbot/buildbot-root/aarch64-darwin/build/unittests/Support -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/unittests/Support -I/Users/buildbot/buildbot-root/aarch64-darwin/build/include -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googletest/include -I/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/third-party/unittest/googlemock/include -isystem /opt/homebrew/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -O3 -DNDEBUG -std=c++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o -c /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/unittests/Support/DebugLogTest.cpp
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/unittests/Support/DebugLogTest.cpp:143:3: error: static assertion failed: DEBUG_TYPE is not defined
  LDBG() << "Hello, world!";
  ^~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: expanded from macro 'LDBG'
#define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: expanded from macro '_GET_LDBG_MACRO'
  LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
                             ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:100:36: note: expanded from macro 'LDBG_NO_ARG_EXPANDER'
#define LDBG_NO_ARG_EXPANDER() , , LDBG_NO_ARG
                                   ^
note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:58: note: expanded from macro 'LDGB_STREAM_LEVEL_AND_TYPE'
  LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
                                                         ^~~~~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:121:63: note: expanded from macro 'LDBG_STREAM_LEVEL_TYPE_AND_FILE'
  LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,   \
                                                              ^~~~~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: expanded from macro 'LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE'
                                          TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
                                          ^~~~~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/unittests/Support/DebugLogTest.cpp:143:3: error: static assertion failed: DEBUG_TYPE is not defined
  LDBG() << "Hello, world!";
  ^~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: expanded from macro 'LDBG'
#define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: expanded from macro '_GET_LDBG_MACRO'
  LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
                             ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:100:36: note: expanded from macro 'LDBG_NO_ARG_EXPANDER'
#define LDBG_NO_ARG_EXPANDER() , , LDBG_NO_ARG
                                   ^
note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:58: note: expanded from macro 'LDGB_STREAM_LEVEL_AND_TYPE'
  LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building llvm,mlir at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/35196

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
256.771 [141/34/656] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CSKYAttributeParserTest.cpp.o
256.944 [140/34/657] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/TypesTest.cpp.o
257.009 [139/34/658] Building CXX object unittests/Object/CMakeFiles/ObjectTests.dir/ELFObjectFileTest.cpp.o
257.074 [138/34/659] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/OperatorTest.cpp.o
257.426 [137/34/660] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/Casting.cpp.o
257.451 [136/34/661] Linking CXX executable unittests/Object/ObjectTests
257.453 [135/34/662] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/Caching.cpp.o
257.728 [134/34/663] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BalancedPartitioningTest.cpp.o
257.982 [133/34/664] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugCounterTest.cpp.o
258.057 [132/34/665] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/unittests/Support -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/DebugLogTest.cpp.o -c /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support/DebugLogTest.cpp
In file included from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support/DebugLogTest.cpp:9:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support/DebugLogTest.cpp: In lambda function:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:210:23: error: static assertion failed: DEBUG_TYPE is not defined
  210 |         static_assert(false, "DEBUG_TYPE is not defined");                     \
      |                       ^~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:109:43: note: in definition of macro ‘LDBG_STREAM_LEVEL_TYPE_FILE_AND_LINE’
  109 |                                           TYPE_OR_LEVEL, LEVEL_OR_TYPE);       \
      |                                           ^~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:124:3: note: in expansion of macro ‘LDBG_STREAM_LEVEL_TYPE_AND_FILE’
  124 |   LDBG_STREAM_LEVEL_TYPE_AND_FILE(STREAM, LEVEL_OR_TYPE, TYPE_OR_LEVEL,        \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:139:3: note: in expansion of macro ‘LDGB_STREAM_LEVEL_AND_TYPE’
  139 |   LDGB_STREAM_LEVEL_AND_TYPE(LDBG_STREAM, (LEVEL_OR_TYPE),                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:140:30: note: in expansion of macro ‘LDBG_GET_DEFAULT_TYPE_OR_LEVEL’
  140 |                              LDBG_GET_DEFAULT_TYPE_OR_LEVEL(LEVEL_OR_TYPE))
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:141:23: note: in expansion of macro ‘LDBG_LEVEL_OR_TYPE’
  141 | #define LDBG_NO_ARG() LDBG_LEVEL_OR_TYPE(1)
      |                       ^~~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:95:47: note: in expansion of macro ‘LDBG_NO_ARG’
   95 | #define LDBG_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
      |                                               ^~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:97:3: note: in expansion of macro ‘LDBG_FUNC_CHOOSER’
   97 |   LDBG_FUNC_CHOOSER argsWithParentheses
      |   ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:99:3: note: in expansion of macro ‘LDBG_FUNC_RECOMPOSER’
   99 |   LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_TYPE_AND_LEVEL, LDBG_LEVEL_OR_TYPE, ))
      |   ^~~~~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:3: note: in expansion of macro ‘LDBG_CHOOSE_FROM_ARG_COUNT’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:102:30: note: in expansion of macro ‘LDBG_NO_ARG_EXPANDER’
  102 |   LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
      |                              ^~~~~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/DebugLog.h:50:19: note: in expansion of macro ‘_GET_LDBG_MACRO’
   50 | #define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)

@joker-eph joker-eph deleted the ldbg_os branch September 11, 2025 12:33
joker-eph added a commit that referenced this pull request Sep 11, 2025
joker-eph added a commit that referenced this pull request Sep 11, 2025
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 11, 2025
joker-eph added a commit to joker-eph/llvm-project that referenced this pull request Sep 12, 2025
Also, improve LDBG() to accept debug type and level in any order, and
add unit-tests for LDBG() and LGDB_OS().

LDBG_OS() is a macro that behaves like LDBG() but instead of directly
using it to stream the output, it takes a callback function that will be
called with a raw_ostream.

Co-authored-by: Andrzej Warzyński <[email protected]>
joker-eph added a commit that referenced this pull request Sep 12, 2025
Also, improve LDBG() to accept debug type and level in any order, and
add unit-tests for LDBG() and LGDB_OS().
LDBG_OS() is a macro that behaves like LDBG() but instead of directly
using it to stream the output, it takes a callback function that will be
called with a raw_ostream.
Co-authored-by: Andrzej Warzyński <[email protected]>

Co-authored-by: Andrzej Warzyński <[email protected]>
joker-eph added a commit that referenced this pull request Sep 12, 2025
joker-eph added a commit that referenced this pull request Sep 12, 2025
…158264)

Reverts #158260

second attempt to land this fixed some bots, but left others broken,
need an extra iteration!
joker-eph added a commit to joker-eph/llvm-project that referenced this pull request Sep 12, 2025
…158260)

Also, improve LDBG() to accept debug type and level in any order, and
add unit-tests for LDBG() and LGDB_OS().
LDBG_OS() is a macro that behaves like LDBG() but instead of directly
using it to stream the output, it takes a callback function that will be
called with a raw_ostream.
Co-authored-by: Andrzej Warzyński <[email protected]>

Co-authored-by: Andrzej Warzyński <[email protected]>
joker-eph added a commit that referenced this pull request Sep 12, 2025
Also, improve LDBG() to accept debug type and level in any order, and
add unit-tests for LDBG() and LGDB_OS().
LDBG_OS() is a macro that behaves like LDBG() but instead of directly
using it to stream the output, it takes a callback function that will be
called with a raw_ostream.

This is a re-land with workarounds for older gcc and clang versions.
Previous attempts in #157194 and #158260 
Co-authored-by: Andrzej Warzyński <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants