[flang-commits] [flang] [flang] Update printing values in dump-parse-tree (PR #112709)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Thu Oct 17 06:53:13 PDT 2024


https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/112709

Remove 'if std::string' that is covered by another branch of the if-statement.
Add printing of 'bool' and 'int' values, since they have corresponding `GetNodeName` definitions.

>From 99d785ba400e50eaf828b3718c82cd76c932381a Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Wed, 16 Oct 2024 15:54:00 -0500
Subject: [PATCH] [flang] Update printing values in dump-parse-tree

Remove 'if std::string' that is covered by another branch of the
if-statement.
Add printing of 'bool' and 'int' values, since they have corresponding
`GetNodeName` definitions.
---
 flang/include/flang/Parser/dump-parse-tree.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h
index 5d243b4e5d3e9a..ccbe5475d051e0 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -884,8 +884,10 @@ class ParseTreeDumper {
     } else if constexpr (HasSource<T>::value) {
       return x.source.ToString();
 #endif
-    } else if constexpr (std::is_same_v<T, std::string>) {
-      return x;
+    } else if constexpr (std::is_same_v<T, int>) {
+      return std::to_string(x);
+    } else if constexpr (std::is_same_v<T, bool>) {
+      return x ? "true" : "false";
     } else {
       return "";
     }



More information about the flang-commits mailing list