// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -ast-dump %s | FileCheck --match-full-lines -implicit-check-not=openmp_structured_block %s void test_one(int x) { #pragma omp distribute for (int i = 0; i < x; i++) ; } void test_two(int x, int y) { #pragma omp distribute for (int i = 0; i < x; i++) for (int i = 0; i < y; i++) ; } void test_three(int x, int y) { #pragma omp distribute collapse(1) for (int i = 0; i < x; i++) for (int i = 0; i < y; i++) ; } void test_four(int x, int y) { #pragma omp distribute collapse(2) for (int i = 0; i < x; i++) for (int i = 0; i < y; i++) ; } void test_five(int x, int y, int z) { #pragma omp distribute collapse(2) for (int i = 0; i < x; i++) for (int i = 0; i < y; i++) for (int i = 0; i < z; i++) ; } // CHECK: TranslationUnitDecl {{.*}} <> // CHECK: |-FunctionDecl {{.*}} <{{.*}}ast-dump-openmp-distribute.c:3:1, line:7:1> line:3:6 test_one 'void (int)' // CHECK-NEXT: | |-ParmVarDecl {{.*}} col:19 used x 'int' // CHECK-NEXT: | `-CompoundStmt {{.*}} // CHECK-NEXT: | `-OMPDistributeDirective {{.*}} // CHECK-NEXT: | `-CapturedStmt {{.*}} // CHECK-NEXT: | |-CapturedDecl {{.*}} <> // CHECK-NEXT: | | |-ForStmt {{.*}} // CHECK-NEXT: | | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | | `-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> // CHECK-NEXT: | | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-NullStmt {{.*}} // CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-distribute.c:4:1) *const restrict' // CHECK-NEXT: | | `-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: |-FunctionDecl {{.*}} line:9:6 test_two 'void (int, int)' // CHECK-NEXT: | |-ParmVarDecl {{.*}} col:19 used x 'int' // CHECK-NEXT: | |-ParmVarDecl {{.*}} col:26 used y 'int' // CHECK-NEXT: | `-CompoundStmt {{.*}} // CHECK-NEXT: | `-OMPDistributeDirective {{.*}} // CHECK-NEXT: | `-CapturedStmt {{.*}} // CHECK-NEXT: | |-CapturedDecl {{.*}} <> // CHECK-NEXT: | | |-ForStmt {{.*}} // CHECK-NEXT: | | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | | `-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> // CHECK-NEXT: | | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-ForStmt {{.*}} // CHECK-NEXT: | | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | | `-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> // CHECK-NEXT: | | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: | | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-NullStmt {{.*}} // CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-distribute.c:10:1) *const restrict' // CHECK-NEXT: | | |-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | `-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | |-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: |-FunctionDecl {{.*}} line:16:6 test_three 'void (int, int)' // CHECK-NEXT: | |-ParmVarDecl {{.*}} col:21 used x 'int' // CHECK-NEXT: | |-ParmVarDecl {{.*}} col:28 used y 'int' // CHECK-NEXT: | `-CompoundStmt {{.*}} // CHECK-NEXT: | `-OMPDistributeDirective {{.*}} // CHECK-NEXT: | |-OMPCollapseClause {{.*}} // CHECK-NEXT: | | `-ConstantExpr {{.*}} 'int' // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 1 // CHECK-NEXT: | `-CapturedStmt {{.*}} // CHECK-NEXT: | |-CapturedDecl {{.*}} <> // CHECK-NEXT: | | |-ForStmt {{.*}} // CHECK-NEXT: | | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | | `-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> // CHECK-NEXT: | | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-ForStmt {{.*}} // CHECK-NEXT: | | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | | `-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> // CHECK-NEXT: | | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: | | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-NullStmt {{.*}} // CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-distribute.c:17:1) *const restrict' // CHECK-NEXT: | | |-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | `-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | |-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: |-FunctionDecl {{.*}} line:23:6 test_four 'void (int, int)' // CHECK-NEXT: | |-ParmVarDecl {{.*}} col:20 used x 'int' // CHECK-NEXT: | |-ParmVarDecl {{.*}} col:27 used y 'int' // CHECK-NEXT: | `-CompoundStmt {{.*}} // CHECK-NEXT: | `-OMPDistributeDirective {{.*}} // CHECK-NEXT: | |-OMPCollapseClause {{.*}} // CHECK-NEXT: | | `-ConstantExpr {{.*}} 'int' // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 2 // CHECK-NEXT: | `-CapturedStmt {{.*}} // CHECK-NEXT: | |-CapturedDecl {{.*}} <> // CHECK-NEXT: | | |-ForStmt {{.*}} // CHECK-NEXT: | | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | | `-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> // CHECK-NEXT: | | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-ForStmt {{.*}} // CHECK-NEXT: | | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | | `-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> // CHECK-NEXT: | | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: | | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-NullStmt {{.*}} // CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-distribute.c:24:1) *const restrict' // CHECK-NEXT: | | |-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | `-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | |-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: `-FunctionDecl {{.*}} line:30:6 test_five 'void (int, int, int)' // CHECK-NEXT: |-ParmVarDecl {{.*}} col:20 used x 'int' // CHECK-NEXT: |-ParmVarDecl {{.*}} col:27 used y 'int' // CHECK-NEXT: |-ParmVarDecl {{.*}} col:34 used z 'int' // CHECK-NEXT: `-CompoundStmt {{.*}} // CHECK-NEXT: `-OMPDistributeDirective {{.*}} // CHECK-NEXT: |-OMPCollapseClause {{.*}} // CHECK-NEXT: | `-ConstantExpr {{.*}} 'int' // CHECK-NEXT: | `-IntegerLiteral {{.*}} 'int' 2 // CHECK-NEXT: `-CapturedStmt {{.*}} // CHECK-NEXT: |-CapturedDecl {{.*}} <> // CHECK-NEXT: | |-ForStmt {{.*}} // CHECK-NEXT: | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | `-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | |-<<>> // CHECK-NEXT: | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | `-ForStmt {{.*}} // CHECK-NEXT: | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | `-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | |-<<>> // CHECK-NEXT: | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | `-ForStmt {{.*}} // CHECK-NEXT: | | |-DeclStmt {{.*}} // CHECK-NEXT: | | | `-VarDecl {{.*}} col:16 used i 'int' cinit // CHECK-NEXT: | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | |-<<>> // CHECK-NEXT: | | |-BinaryOperator {{.*}} 'int' '<' // CHECK-NEXT: | | | |-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} 'int' // CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'z' 'int' // CHECK-NEXT: | | |-UnaryOperator {{.*}} 'int' postfix '++' // CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int' // CHECK-NEXT: | | `-NullStmt {{.*}} // CHECK-NEXT: | |-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-distribute.c:31:1) *const restrict' // CHECK-NEXT: | |-VarDecl {{.*}} col:12 used i 'int' cinit // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | |-VarDecl {{.*}} col:14 used i 'int' cinit // CHECK-NEXT: | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | `-VarDecl {{.*}} col:16 used i 'int' cinit // CHECK-NEXT: | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: |-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int' // CHECK-NEXT: |-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int' // CHECK-NEXT: `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'z' 'int'