Skip to content

Commit 2c93598

Browse files
authored
[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.
1 parent 2bebeea commit 2c93598

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

flang/include/flang/Parser/dump-parse-tree.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,10 @@ class ParseTreeDumper {
884884
} else if constexpr (HasSource<T>::value) {
885885
return x.source.ToString();
886886
#endif
887-
} else if constexpr (std::is_same_v<T, std::string>) {
888-
return x;
887+
} else if constexpr (std::is_same_v<T, int>) {
888+
return std::to_string(x);
889+
} else if constexpr (std::is_same_v<T, bool>) {
890+
return x ? "true" : "false";
889891
} else {
890892
return "";
891893
}

flang/test/Parser/OpenMP/allocate-tree.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ program allocate_tree
1818
allocate(w, xarray(4), zarray(t, z))
1919
end program allocate_tree
2020

21+
!CHECK: | | DeclarationConstruct -> SpecificationConstruct -> TypeDeclarationStmt
22+
!CHECK-NEXT: | | | DeclarationTypeSpec -> IntrinsicTypeSpec -> IntegerTypeSpec ->
23+
!CHECK-NEXT: | | | AttrSpec -> Allocatable
24+
!CHECK-NEXT: | | | EntityDecl
25+
!CHECK-NEXT: | | | | Name = 'w'
26+
!CHECK-NEXT: | | | EntityDecl
27+
!CHECK-NEXT: | | | | Name = 'xarray'
28+
!CHECK-NEXT: | | | | ArraySpec -> DeferredShapeSpecList -> int = '1'
29+
!CHECK-NEXT: | | | EntityDecl
30+
!CHECK-NEXT: | | | | Name = 'zarray'
31+
!CHECK-NEXT: | | | | ArraySpec -> DeferredShapeSpecList -> int = '2'
32+
33+
2134
!CHECK: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPExecutableAllocate
2235
!CHECK-NEXT: | | | Verbatim
2336
!CHECK-NEXT: | | | OmpClauseList ->

0 commit comments

Comments
 (0)