[Mlir-commits] [mlir] [MLIR] Fix TypeID anonymous namespace check to handle GCC's __PRETTY_FUNCTION__ format (PR #199634)

Hocky Yudhiono llvmlistbot at llvm.org
Tue May 26 23:49:49 PDT 2026


https://github.com/hockyy updated https://github.com/llvm/llvm-project/pull/199634

>From be7349439c305ebc2a140fd4a6eae57022baf989 Mon Sep 17 00:00:00 2001
From: mieshkiwrk <mieszko.dziadowiec at intel.com>
Date: Tue, 26 May 2026 08:48:18 +0000
Subject: [PATCH] Extent TypeID checks for anonymous namespace with different
 compilers

---
 mlir/lib/Support/TypeID.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/mlir/lib/Support/TypeID.cpp b/mlir/lib/Support/TypeID.cpp
index 3526a0d49cc79..2c6193e78743e 100644
--- a/mlir/lib/Support/TypeID.cpp
+++ b/mlir/lib/Support/TypeID.cpp
@@ -30,12 +30,14 @@ struct ImplicitTypeIDRegistry {
     // Perform a heuristic check to see if this type is in an anonymous
     // namespace. String equality is not valid for anonymous types, so we try to
     // abort whenever we see them.
+    // Check all known anonymous-namespace markers unconditionally:
+    //   Clang : "(anonymous namespace)"
+    //   GCC   : "{anonymous}"
+    //   MSVC  : "anonymous-namespace"
 #ifndef NDEBUG
-#if defined(_MSC_VER)
-    if (typeName.contains("anonymous-namespace")) {
-#else
-    if (typeName.contains("anonymous namespace")) {
-#endif
+    if (typeName.contains("anonymous namespace") ||
+        typeName.contains("{anonymous}") ||
+        typeName.contains("anonymous-namespace")) {
       std::string errorStr;
       {
         llvm::raw_string_ostream errorOS(errorStr);



More information about the Mlir-commits mailing list