From be2c6c1960e57cf9b6c8c006bcb065c39af78621 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Tue, 21 Oct 2025 06:29:01 -0500 Subject: [PATCH] [flang] Fix dumping type names for clang in DumpEvExpr (#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 = ...] whereas clang uses [T = ...] 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 9cc52b4da487..2dbd4cb60be5 100644 --- a/flang/include/flang/Semantics/dump-expr.h +++ b/flang/include/flang/Semantics/dump-expr.h @@ -46,7 +46,11 @@ private: 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 @@ private: } } #endif - return ""; }