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

via flang-commits flang-commits at lists.llvm.org
Tue Oct 21 04:29:06 PDT 2025


Author: Krzysztof Parzyszek
Date: 2025-10-21T06:29:01-05:00
New Revision: be2c6c1960e57cf9b6c8c006bcb065c39af78621

URL: https://github.com/llvm/llvm-project/commit/be2c6c1960e57cf9b6c8c006bcb065c39af78621
DIFF: https://github.com/llvm/llvm-project/commit/be2c6c1960e57cf9b6c8c006bcb065c39af78621.diff

LOG: [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 = <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.

Added: 
    

Modified: 
    flang/include/flang/Semantics/dump-expr.h

Removed: 
    


################################################################################
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