Skip to content

Commit 2d90af5

Browse files
authored
[flang][OpenMP] Add unparsing of BIND clause argument (#117776)
Currently the argument of the BIND clause is not printed. This is likely an omission in the original implementation.
1 parent 003b48e commit 2d90af5

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

flang/lib/Parser/unparse.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,6 +2834,7 @@ class UnparseVisitor {
28342834
WALK_NESTED_ENUM(InquireSpec::LogVar, Kind)
28352835
WALK_NESTED_ENUM(ProcedureStmt, Kind) // R1506
28362836
WALK_NESTED_ENUM(UseStmt, ModuleNature) // R1410
2837+
WALK_NESTED_ENUM(OmpBindClause, Type) // OMP bind
28372838
WALK_NESTED_ENUM(OmpProcBindClause, Type) // OMP PROC_BIND
28382839
WALK_NESTED_ENUM(OmpDefaultClause, Type) // OMP DEFAULT
28392840
WALK_NESTED_ENUM(OmpDefaultmapClause, ImplicitBehavior) // OMP DEFAULTMAP
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
!RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case --check-prefix="UNPARSE" %s
2+
!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50 %s | FileCheck --check-prefix="PARSE-TREE" %s
3+
4+
subroutine f00
5+
!$omp loop bind(parallel)
6+
do i = 1, 10
7+
continue
8+
enddo
9+
!$omp end loop
10+
end
11+
12+
!UNPARSE: SUBROUTINE f00
13+
!UNPARSE: !$OMP LOOP BIND(PARALLEL)
14+
!UNPARSE: DO i=1_4,10_4
15+
!UNPARSE: CONTINUE
16+
!UNPARSE: END DO
17+
!UNPARSE: !$OMP END LOOP
18+
!UNPARSE: END SUBROUTINE
19+
20+
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
21+
!PARSE-TREE: | OmpBeginLoopDirective
22+
!PARSE-TREE: | | OmpLoopDirective -> llvm::omp::Directive = loop
23+
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Bind -> OmpBindClause -> Type = Parallel
24+
!PARSE-TREE: | DoConstruct
25+

0 commit comments

Comments
 (0)