Skip to content

Commit 375b7d0

Browse files
committed
Guard more code
1 parent f7a2234 commit 375b7d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,34 @@ class DumpEvaluateExpr {
4242
template <typename T> struct TypeOf {
4343
static constexpr std::string_view get() {
4444
#if defined(__GNUC__)
45+
#define DUMP_EXPR_SHOW_TYPE
4546
std::string_view v(__PRETTY_FUNCTION__);
4647
// Extract the "xyz" from the "pretty function" string:
4748
// "... [with T = xyz; std::string_view = ...]"
4849
std::string_view front("with T = ");
4950
std::string_view back("; std::string_view =");
5051

5152
#elif defined(_MSC_VER)
53+
#define DUMP_EXPR_SHOW_TYPE
5254
std::string_view v(__FUNCSIG__);
5355
// Extract the "xyz" from the "pretty function" string:
5456
// "...TypeOf<xyz>::get(void)"
5557
std::string_view front("TypeOf<");
5658
std::string_view back(">::get(void)");
5759

58-
#else
59-
return "";
6060
#endif
6161

62+
#if defined(DUMP_EXPR_SHOW_TYPE)
63+
#undef DUMP_EXPR_SHOW_TYPE
6264
if (auto fpos{v.find(front)}; fpos != v.npos) {
6365
v.remove_prefix(fpos + front.size());
6466
if (auto bpos{v.find(back)}; bpos != v.npos) {
6567
v.remove_suffix(v.size() - bpos);
6668
return v;
6769
}
6870
}
71+
#endif
72+
6973
return "";
7074
}
7175

0 commit comments

Comments
 (0)