[flang-commits] [flang] [flang] Fix dumping type names for clang in DumpEvExpr (PR #164256)

via flang-commits flang-commits at lists.llvm.org
Mon Oct 20 06:49:51 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Krzysztof Parzyszek (kparzysz)

<details>
<summary>Changes</summary>

The gcc/clang implementation uses \_\_PRETTY_FUNCTION\_\_ to generate the full function name, and then extracts the type name from it. GCC emits the type name in the form of
`[with T = <type-name>...]`
whereas clang uses
`[T = <type-name>...]`
The current code looked for "with T =" to get the location of the type name, which did not work in clang-generated code.

---
Full diff: https://github.com/llvm/llvm-project/pull/164256.diff


1 Files Affected:

- (modified) flang/include/flang/Semantics/dump-expr.h (+5-2) 


``````````diff
diff --git a/flang/include/flang/Semantics/dump-expr.h b/flang/include/flang/Semantics/dump-expr.h
index 9cc52b4da487d..2dbd4cb60be59 100644
--- a/flang/include/flang/Semantics/dump-expr.h
+++ b/flang/include/flang/Semantics/dump-expr.h
@@ -46,7 +46,11 @@ class DumpEvaluateExpr {
       std::string_view v(__PRETTY_FUNCTION__);
       // Extract the "xyz" from the "pretty function" string:
       // "... [with T = xyz; std::string_view = ...]"
-      std::string_view front("with T = ");
+#ifdef __clang__
+      std::string_view front("[T = ");
+#else
+      std::string_view front("[with T = ");
+#endif
       std::string_view back("; std::string_view =");
 
 #elif defined(_MSC_VER)
@@ -69,7 +73,6 @@ class DumpEvaluateExpr {
         }
       }
 #endif
-
       return "";
     }
 

``````````

</details>


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


More information about the flang-commits mailing list