[flang-commits] [flang] [flang] Fix dumping type names for clang in DumpEvExpr (PR #164256)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Mon Oct 20 06:49:14 PDT 2025
https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/164256
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.
>From e8288c0ef900c4b4f11cda09995c678e72f82972 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Mon, 20 Oct 2025 06:47:50 -0500
Subject: [PATCH] [flang] Fix dumping type names for clang in DumpEvExpr
The gcc/clang implementation uses __PRETTY_FUNCTION__ to generate a
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.
---
flang/include/flang/Semantics/dump-expr.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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 "";
}
More information about the flang-commits
mailing list