[flang-commits] [flang] 2c93598 - [flang] Update printing values in dump-parse-tree (#112709)
via flang-commits
flang-commits at lists.llvm.org
Thu Oct 17 10:50:13 PDT 2024
Author: Krzysztof Parzyszek
Date: 2024-10-17T12:50:10-05:00
New Revision: 2c93598b32c217c605dc4eeea8e37eae2ba5799a
URL: https://github.com/llvm/llvm-project/commit/2c93598b32c217c605dc4eeea8e37eae2ba5799a
DIFF: https://github.com/llvm/llvm-project/commit/2c93598b32c217c605dc4eeea8e37eae2ba5799a.diff
LOG: [flang] Update printing values in dump-parse-tree (#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.
Added:
Modified:
flang/include/flang/Parser/dump-parse-tree.h
flang/test/Parser/OpenMP/allocate-tree.f90
Removed:
################################################################################
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 "";
}
diff --git a/flang/test/Parser/OpenMP/allocate-tree.f90 b/flang/test/Parser/OpenMP/allocate-tree.f90
index 9de257b00dc32f..bf413d591baf23 100644
--- a/flang/test/Parser/OpenMP/allocate-tree.f90
+++ b/flang/test/Parser/OpenMP/allocate-tree.f90
@@ -18,6 +18,19 @@ program allocate_tree
allocate(w, xarray(4), zarray(t, z))
end program allocate_tree
+!CHECK: | | DeclarationConstruct -> SpecificationConstruct -> TypeDeclarationStmt
+!CHECK-NEXT: | | | DeclarationTypeSpec -> IntrinsicTypeSpec -> IntegerTypeSpec ->
+!CHECK-NEXT: | | | AttrSpec -> Allocatable
+!CHECK-NEXT: | | | EntityDecl
+!CHECK-NEXT: | | | | Name = 'w'
+!CHECK-NEXT: | | | EntityDecl
+!CHECK-NEXT: | | | | Name = 'xarray'
+!CHECK-NEXT: | | | | ArraySpec -> DeferredShapeSpecList -> int = '1'
+!CHECK-NEXT: | | | EntityDecl
+!CHECK-NEXT: | | | | Name = 'zarray'
+!CHECK-NEXT: | | | | ArraySpec -> DeferredShapeSpecList -> int = '2'
+
+
!CHECK: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPExecutableAllocate
!CHECK-NEXT: | | | Verbatim
!CHECK-NEXT: | | | OmpClauseList ->
More information about the flang-commits
mailing list