• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -ast-dump %s | FileCheck --match-full-lines -implicit-check-not=openmp_structured_block %s
2 
test_one()3 void test_one() {
4 #pragma omp ordered
5   ;
6 }
7 
test_two(int x)8 void test_two(int x) {
9 #pragma omp for ordered
10   for (int i = 0; i < x; i++)
11     ;
12 }
13 
test_three(int x)14 void test_three(int x) {
15 #pragma omp for ordered(1)
16   for (int i = 0; i < x; i++) {
17 #pragma omp ordered depend(source)
18   }
19 }
20 
21 // CHECK: TranslationUnitDecl {{.*}} <<invalid sloc>> <invalid sloc>
22 // CHECK: |-FunctionDecl {{.*}} <{{.*}}ast-dump-openmp-ordered.c:3:1, line:6:1> line:3:6 test_one 'void ()'
23 // CHECK-NEXT: | `-CompoundStmt {{.*}} <col:17, line:6:1>
24 // CHECK-NEXT: |   `-OMPOrderedDirective {{.*}} <line:4:1, col:20>
25 // CHECK-NEXT: |     `-CapturedStmt {{.*}} <line:5:3>
26 // CHECK-NEXT: |       `-CapturedDecl {{.*}} <<invalid sloc>> <invalid sloc>
27 // CHECK-NEXT: |         |-NullStmt {{.*}} <col:3>
28 // CHECK-NEXT: |         `-ImplicitParamDecl {{.*}} <line:4:1> col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-ordered.c:4:1) *const restrict'
29 // CHECK-NEXT: |-FunctionDecl {{.*}} <line:8:1, line:12:1> line:8:6 test_two 'void (int)'
30 // CHECK-NEXT: | |-ParmVarDecl {{.*}} <col:15, col:19> col:19 used x 'int'
31 // CHECK-NEXT: | `-CompoundStmt {{.*}} <col:22, line:12:1>
32 // CHECK-NEXT: |   `-OMPForDirective {{.*}} <line:9:1, col:24>
33 // CHECK-NEXT: |     |-OMPOrderedClause {{.*}} <col:17, col:24>
34 // CHECK-NEXT: |     | `-<<<NULL>>>
35 // CHECK-NEXT: |     `-CapturedStmt {{.*}} <line:10:3, line:11:5>
36 // CHECK-NEXT: |       |-CapturedDecl {{.*}} <<invalid sloc>> <invalid sloc>
37 // CHECK-NEXT: |       | |-ForStmt {{.*}} <line:10:3, line:11:5>
38 // CHECK-NEXT: |       | | |-DeclStmt {{.*}} <line:10:8, col:17>
39 // CHECK-NEXT: |       | | | `-VarDecl {{.*}} <col:8, col:16> col:12 used i 'int' cinit
40 // CHECK-NEXT: |       | | |   `-IntegerLiteral {{.*}} <col:16> 'int' 0
41 // CHECK-NEXT: |       | | |-<<<NULL>>>
42 // CHECK-NEXT: |       | | |-BinaryOperator {{.*}} <col:19, col:23> 'int' '<'
43 // CHECK-NEXT: |       | | | |-ImplicitCastExpr {{.*}} <col:19> 'int' <LValueToRValue>
44 // CHECK-NEXT: |       | | | | `-DeclRefExpr {{.*}} <col:19> 'int' lvalue Var {{.*}} 'i' 'int'
45 // CHECK-NEXT: |       | | | `-ImplicitCastExpr {{.*}} <col:23> 'int' <LValueToRValue>
46 // CHECK-NEXT: |       | | |   `-DeclRefExpr {{.*}} <col:23> 'int' lvalue ParmVar {{.*}} 'x' 'int'
47 // CHECK-NEXT: |       | | |-UnaryOperator {{.*}} <col:26, col:27> 'int' postfix '++'
48 // CHECK-NEXT: |       | | | `-DeclRefExpr {{.*}} <col:26> 'int' lvalue Var {{.*}} 'i' 'int'
49 // CHECK-NEXT: |       | | `-NullStmt {{.*}} <line:11:5>
50 // CHECK-NEXT: |       | |-ImplicitParamDecl {{.*}} <line:9:1> col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-ordered.c:9:1) *const restrict'
51 // CHECK-NEXT: |       | `-VarDecl {{.*}} <line:10:8, col:16> col:12 used i 'int' cinit
52 // CHECK-NEXT: |       |   `-IntegerLiteral {{.*}} <col:16> 'int' 0
53 // CHECK-NEXT: |       `-DeclRefExpr {{.*}} <col:3> 'int' lvalue ParmVar {{.*}} 'x' 'int'
54 // CHECK-NEXT: `-FunctionDecl {{.*}} <line:14:1, line:19:1> line:14:6 test_three 'void (int)'
55 // CHECK-NEXT:   |-ParmVarDecl {{.*}} <col:17, col:21> col:21 used x 'int'
56 // CHECK-NEXT:   `-CompoundStmt {{.*}} <col:24, line:19:1>
57 // CHECK-NEXT:     `-OMPForDirective {{.*}} <line:15:1, col:27>
58 // CHECK-NEXT:       |-OMPOrderedClause {{.*}} <col:17, col:26>
59 // CHECK-NEXT:       | `-ConstantExpr {{.*}} <col:25> 'int'
60 // CHECK-NEXT:       |   `-IntegerLiteral {{.*}} <col:25> 'int' 1
61 // CHECK-NEXT:       `-CapturedStmt {{.*}} <line:16:3, line:18:3>
62 // CHECK-NEXT:         |-CapturedDecl {{.*}} <<invalid sloc>> <invalid sloc>
63 // CHECK-NEXT:         | |-ForStmt {{.*}} <line:16:3, line:18:3>
64 // CHECK-NEXT:         | | |-DeclStmt {{.*}} <line:16:8, col:17>
65 // CHECK-NEXT:         | | | `-VarDecl {{.*}} <col:8, col:16> col:12 used i 'int' cinit
66 // CHECK-NEXT:         | | |   `-IntegerLiteral {{.*}} <col:16> 'int' 0
67 // CHECK-NEXT:         | | |-<<<NULL>>>
68 // CHECK-NEXT:         | | |-BinaryOperator {{.*}} <col:19, col:23> 'int' '<'
69 // CHECK-NEXT:         | | | |-ImplicitCastExpr {{.*}} <col:19> 'int' <LValueToRValue>
70 // CHECK-NEXT:         | | | | `-DeclRefExpr {{.*}} <col:19> 'int' lvalue Var {{.*}} 'i' 'int'
71 // CHECK-NEXT:         | | | `-ImplicitCastExpr {{.*}} <col:23> 'int' <LValueToRValue>
72 // CHECK-NEXT:         | | |   `-DeclRefExpr {{.*}} <col:23> 'int' lvalue ParmVar {{.*}} 'x' 'int'
73 // CHECK-NEXT:         | | |-UnaryOperator {{.*}} <col:26, col:27> 'int' postfix '++'
74 // CHECK-NEXT:         | | | `-DeclRefExpr {{.*}} <col:26> 'int' lvalue Var {{.*}} 'i' 'int'
75 // CHECK-NEXT:         | | `-CompoundStmt {{.*}} <col:31, line:18:3>
76 // CHECK-NEXT:         | |   `-OMPOrderedDirective {{.*}} <line:17:1, col:35> openmp_standalone_directive
77 // CHECK-NEXT:         | |     `-OMPDependClause {{.*}} <col:21, <invalid sloc>>
78 // CHECK-NEXT:         | |-ImplicitParamDecl {{.*}} <line:15:1> col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-ordered.c:15:1) *const restrict'
79 // CHECK-NEXT:         | `-VarDecl {{.*}} <line:16:8, col:16> col:12 used i 'int' cinit
80 // CHECK-NEXT:         |   `-IntegerLiteral {{.*}} <col:16> 'int' 0
81 // CHECK-NEXT:         `-DeclRefExpr {{.*}} <col:3> 'int' lvalue ParmVar {{.*}} 'x' 'int'
82