-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang] Update printing values in dump-parse-tree #112709
Conversation
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.
@llvm/pr-subscribers-flang-openmp @llvm/pr-subscribers-flang-parser Author: Krzysztof Parzyszek (kparzysz) ChangesRemove 'if std::string' that is covered by another branch of the if-statement. Full diff: https://github.com/llvm/llvm-project/pull/112709.diff 1 Files Affected:
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 "";
}
|
Can we have a test since this patch is non-NFC? |
There aren't really any tests for dumping the parse tree, except for OpenMP. The difference (at least for the |
Source:
Tree before:
Tree after (compare the 3rd line from the bottom):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add an OpenMP testcase that has this declaration plus some OMP construct for the sake of being an OpenMP test... What do you think?
If you can add a test that would be great. But no pressure.
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.