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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-parser

Author: Krzysztof Parzyszek (kparzysz)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/112709.diff


1 Files Affected:

- (modified) flang/include/flang/Parser/dump-parse-tree.h (+4-2) 


``````````diff
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 "";
     }

``````````

</details>


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


More information about the flang-commits mailing list