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

Mieszko Dziadowiec llvmlistbot at llvm.org
Tue May 26 03:42:24 PDT 2026


================
@@ -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")) {
----------------
mieshkiwrk wrote:

My understanding is that LLVM can be built for example using `gcc` but then it can be used inside some other component that's being built for example via `clang` - there can be mismatch in searched patterns.

So in my opinion simple `if` statement is more safe.

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


More information about the Mlir-commits mailing list