Skip to content

Commit a5c87eb

Browse files
kparzyszLukacma
authored andcommitted
[flang] Fix dumping type names for clang in DumpEvExpr (llvm#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.
1 parent d5ee5ef commit a5c87eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ class DumpEvaluateExpr {
4646
std::string_view v(__PRETTY_FUNCTION__);
4747
// Extract the "xyz" from the "pretty function" string:
4848
// "... [with T = xyz; std::string_view = ...]"
49-
std::string_view front("with T = ");
49+
#ifdef __clang__
50+
std::string_view front("[T = ");
51+
#else
52+
std::string_view front("[with T = ");
53+
#endif
5054
std::string_view back("; std::string_view =");
5155

5256
#elif defined(_MSC_VER)
@@ -69,7 +73,6 @@ class DumpEvaluateExpr {
6973
}
7074
}
7175
#endif
72-
7376
return "";
7477
}
7578

0 commit comments

Comments
 (0)