xref: /llvm-project/flang/test/Parser/OpenMP/defaultmap-clause.f90 (revision 4fc1141e7650901b34cc8eec0c770e9015204087)
1!RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=52 %s | FileCheck --ignore-case --check-prefix="UNPARSE" %s
2!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=52 %s | FileCheck --check-prefix="PARSE-TREE" %s
3
4subroutine f00
5  !$omp target defaultmap(from)
6  !$omp end target
7end
8
9!UNPARSE: SUBROUTINE f00
10!UNPARSE: !$OMP TARGET  DEFAULTMAP(FROM)
11!UNPARSE: !$OMP END TARGET
12!UNPARSE: END SUBROUTINE
13
14!PARSE-TREE: OmpBeginBlockDirective
15!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
16!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
17!PARSE-TREE: | | ImplicitBehavior = From
18!PARSE-TREE: Block
19
20subroutine f01
21  !$omp target defaultmap(firstprivate: aggregate)
22  !$omp end target
23end
24
25!UNPARSE: SUBROUTINE f01
26!UNPARSE: !$OMP TARGET  DEFAULTMAP(FIRSTPRIVATE:AGGREGATE)
27!UNPARSE: !$OMP END TARGET
28!UNPARSE: END SUBROUTINE
29
30!PARSE-TREE: OmpBeginBlockDirective
31!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
32!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
33!PARSE-TREE: | | ImplicitBehavior = Firstprivate
34!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Aggregate
35
36subroutine f02
37  !$omp target defaultmap(alloc: all)
38  !$omp end target
39end
40
41!UNPARSE: SUBROUTINE f02
42!UNPARSE: !$OMP TARGET  DEFAULTMAP(ALLOC:ALL)
43!UNPARSE: !$OMP END TARGET
44!UNPARSE: END SUBROUTINE
45
46!PARSE-TREE: OmpBeginBlockDirective
47!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
48!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
49!PARSE-TREE: | | ImplicitBehavior = Alloc
50!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = All
51
52! Both "all" and "allocatable" are valid, and "all" is a prefix of
53! "allocatable". Make sure we parse this correctly.
54subroutine f03
55  !$omp target defaultmap(alloc: allocatable)
56  !$omp end target
57end
58
59!UNPARSE: SUBROUTINE f03
60!UNPARSE: !$OMP TARGET  DEFAULTMAP(ALLOC:ALLOCATABLE)
61!UNPARSE: !$OMP END TARGET
62!UNPARSE: END SUBROUTINE
63
64!PARSE-TREE: OmpBeginBlockDirective
65!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
66!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
67!PARSE-TREE: | | ImplicitBehavior = Alloc
68!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Allocatable
69
70subroutine f04
71  !$omp target defaultmap(tofrom: scalar)
72  !$omp end target
73end
74
75!UNPARSE: SUBROUTINE f04
76!UNPARSE: !$OMP TARGET  DEFAULTMAP(TOFROM:SCALAR)
77!UNPARSE: !$OMP END TARGET
78!UNPARSE: END SUBROUTINE
79
80!PARSE-TREE: OmpBeginBlockDirective
81!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target
82!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
83!PARSE-TREE: | | ImplicitBehavior = Tofrom
84!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value  = Scalar
85