From 2e2c02c0cdd45a59faf81bd5c87688b21a5a0d9a Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 2 Jun 2019 04:00:38 +0000 Subject: [PATCH] Add script to update OpenMP -ast-dump test expectations, and use it to regenerate the test expectations. (Only two tests change, as a result of no longer matching the 0x in a pointer; the other tests were already excluding that.) llvm-svn: 362316 --- clang/test/AST/ast-dump-openmp-for.c | 390 +++++++++++----------- clang/test/AST/ast-dump-openmp-parallel.c | 20 +- clang/utils/make-ast-dump-check.sh | 79 +++++ 3 files changed, 284 insertions(+), 205 deletions(-) create mode 100755 clang/utils/make-ast-dump-check.sh diff --git a/clang/test/AST/ast-dump-openmp-for.c b/clang/test/AST/ast-dump-openmp-for.c index 557424d1926e..a19a3e4951f1 100644 --- a/clang/test/AST/ast-dump-openmp-for.c +++ b/clang/test/AST/ast-dump-openmp-for.c @@ -35,208 +35,208 @@ void test_five(int x, int y, int z) { ; } -// CHECK: TranslationUnitDecl 0x{{.*}} <> -// CHECK: |-FunctionDecl 0x{{.*}} <{{.*}}ast-dump-openmp-for.c:3:1, line:7:1> line:3:6 test_one 'void (int)' -// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}} col:19 used x 'int' -// CHECK-NEXT: | `-CompoundStmt 0x{{.*}} -// CHECK-NEXT: | `-OMPForDirective 0x{{.*}} -// CHECK-NEXT: | `-CapturedStmt 0x{{.*}} -// CHECK-NEXT: | |-CapturedDecl 0x{{.*}} <> -// CHECK-NEXT: | | |-ForStmt 0x{{.*}} -// CHECK-NEXT: | | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | | `-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// CHECK: TranslationUnitDecl {{.*}} <> +// CHECK: |-FunctionDecl {{.*}} <{{.*}}ast-dump-openmp-for.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: | `-OMPForDirective {{.*}} +// 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 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-NullStmt 0x{{.*}} openmp_structured_block -// CHECK-NEXT: | | |-ImplicitParamDecl 0x{{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.c:4:1) *const restrict' -// CHECK-NEXT: | | `-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: |-FunctionDecl 0x{{.*}} line:9:6 test_two 'void (int, int)' -// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}} col:19 used x 'int' -// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}} col:26 used y 'int' -// CHECK-NEXT: | `-CompoundStmt 0x{{.*}} -// CHECK-NEXT: | `-OMPForDirective 0x{{.*}} -// CHECK-NEXT: | `-CapturedStmt 0x{{.*}} -// CHECK-NEXT: | |-CapturedDecl 0x{{.*}} <> -// CHECK-NEXT: | | |-ForStmt 0x{{.*}} -// CHECK-NEXT: | | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | | `-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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 {{.*}} openmp_structured_block +// CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.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: | `-OMPForDirective {{.*}} +// 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 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-ForStmt 0x{{.*}} openmp_structured_block -// CHECK-NEXT: | | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | | `-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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 {{.*}} openmp_structured_block +// CHECK-NEXT: | | | |-DeclStmt {{.*}} +// CHECK-NEXT: | | | | `-VarDecl {{.*}} col:14 used i 'int' cinit +// CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> -// CHECK-NEXT: | | | |-BinaryOperator 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: | | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-NullStmt 0x{{.*}} -// CHECK-NEXT: | | |-ImplicitParamDecl 0x{{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.c:10:1) *const restrict' -// CHECK-NEXT: | | |-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | | `-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | |-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: |-FunctionDecl 0x{{.*}} line:16:6 test_three 'void (int, int)' -// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}} col:21 used x 'int' -// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}} col:28 used y 'int' -// CHECK-NEXT: | `-CompoundStmt 0x{{.*}} -// CHECK-NEXT: | `-OMPForDirective 0x{{.*}} -// CHECK-NEXT: | |-OMPCollapseClause 0x{{.*}} -// CHECK-NEXT: | | `-ConstantExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 1 -// CHECK-NEXT: | `-CapturedStmt 0x{{.*}} -// CHECK-NEXT: | |-CapturedDecl 0x{{.*}} <> -// CHECK-NEXT: | | |-ForStmt 0x{{.*}} -// CHECK-NEXT: | | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | | `-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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-for.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: | `-OMPForDirective {{.*}} +// 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 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-ForStmt 0x{{.*}} openmp_structured_block -// CHECK-NEXT: | | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | | `-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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 {{.*}} openmp_structured_block +// CHECK-NEXT: | | | |-DeclStmt {{.*}} +// CHECK-NEXT: | | | | `-VarDecl {{.*}} col:14 used i 'int' cinit +// CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | | |-<<>> -// CHECK-NEXT: | | | |-BinaryOperator 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: | | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-NullStmt 0x{{.*}} -// CHECK-NEXT: | | |-ImplicitParamDecl 0x{{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.c:17:1) *const restrict' -// CHECK-NEXT: | | |-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | | `-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | |-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: |-FunctionDecl 0x{{.*}} line:23:6 test_four 'void (int, int)' -// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}} col:20 used x 'int' -// CHECK-NEXT: | |-ParmVarDecl 0x{{.*}} col:27 used y 'int' -// CHECK-NEXT: | `-CompoundStmt 0x{{.*}} -// CHECK-NEXT: | `-OMPForDirective 0x{{.*}} -// CHECK-NEXT: | |-OMPCollapseClause 0x{{.*}} -// CHECK-NEXT: | | `-ConstantExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 2 -// CHECK-NEXT: | `-CapturedStmt 0x{{.*}} -// CHECK-NEXT: | |-CapturedDecl 0x{{.*}} <> -// CHECK-NEXT: | | |-ForStmt 0x{{.*}} -// CHECK-NEXT: | | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | | `-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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-for.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: | `-OMPForDirective {{.*}} +// 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 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-ForStmt 0x{{.*}} -// CHECK-NEXT: | | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | | `-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: | | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-NullStmt 0x{{.*}} openmp_structured_block -// CHECK-NEXT: | | |-ImplicitParamDecl 0x{{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.c:24:1) *const restrict' -// CHECK-NEXT: | | |-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | | `-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | |-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: `-FunctionDecl 0x{{.*}} line:30:6 test_five 'void (int, int, int)' -// CHECK-NEXT: |-ParmVarDecl 0x{{.*}} col:20 used x 'int' -// CHECK-NEXT: |-ParmVarDecl 0x{{.*}} col:27 used y 'int' -// CHECK-NEXT: |-ParmVarDecl 0x{{.*}} col:34 used z 'int' -// CHECK-NEXT: `-CompoundStmt 0x{{.*}} -// CHECK-NEXT: `-OMPForDirective 0x{{.*}} -// CHECK-NEXT: |-OMPCollapseClause 0x{{.*}} -// CHECK-NEXT: | `-ConstantExpr 0x{{.*}} 'int' -// CHECK-NEXT: | `-IntegerLiteral 0x{{.*}} 'int' 2 -// CHECK-NEXT: `-CapturedStmt 0x{{.*}} -// CHECK-NEXT: |-CapturedDecl 0x{{.*}} <> -// CHECK-NEXT: | |-ForStmt 0x{{.*}} -// CHECK-NEXT: | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | `-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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 {{.*}} openmp_structured_block +// CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.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: `-OMPForDirective {{.*}} +// 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 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | `-ForStmt 0x{{.*}} -// CHECK-NEXT: | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | `-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | `-ForStmt 0x{{.*}} openmp_structured_block -// CHECK-NEXT: | | |-DeclStmt 0x{{.*}} -// CHECK-NEXT: | | | `-VarDecl 0x{{.*}} col:16 used i 'int' cinit -// CHECK-NEXT: | | | `-IntegerLiteral 0x{{.*}} 'int' 0 +// 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 {{.*}} openmp_structured_block +// CHECK-NEXT: | | |-DeclStmt {{.*}} +// CHECK-NEXT: | | | `-VarDecl {{.*}} col:16 used i 'int' cinit +// CHECK-NEXT: | | | `-IntegerLiteral {{.*}} 'int' 0 // CHECK-NEXT: | | |-<<>> -// CHECK-NEXT: | | |-BinaryOperator 0x{{.*}} 'int' '<' -// CHECK-NEXT: | | | |-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | | `-ImplicitCastExpr 0x{{.*}} 'int' -// CHECK-NEXT: | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'z' 'int' -// CHECK-NEXT: | | |-UnaryOperator 0x{{.*}} 'int' postfix '++' -// CHECK-NEXT: | | | `-DeclRefExpr 0x{{.*}} 'int' lvalue Var 0x{{.*}} 'i' 'int' -// CHECK-NEXT: | | `-NullStmt 0x{{.*}} -// CHECK-NEXT: | |-ImplicitParamDecl 0x{{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-for.c:31:1) *const restrict' -// CHECK-NEXT: | |-VarDecl 0x{{.*}} col:12 used i 'int' cinit -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | |-VarDecl 0x{{.*}} col:14 used i 'int' cinit -// CHECK-NEXT: | | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: | `-VarDecl 0x{{.*}} col:16 used i 'int' cinit -// CHECK-NEXT: | `-IntegerLiteral 0x{{.*}} 'int' 0 -// CHECK-NEXT: |-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'x' 'int' -// CHECK-NEXT: |-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'y' 'int' -// CHECK-NEXT: `-DeclRefExpr 0x{{.*}} 'int' lvalue ParmVar 0x{{.*}} 'z' 'int' +// 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-for.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' diff --git a/clang/test/AST/ast-dump-openmp-parallel.c b/clang/test/AST/ast-dump-openmp-parallel.c index ba33546681b5..ff599d68098a 100644 --- a/clang/test/AST/ast-dump-openmp-parallel.c +++ b/clang/test/AST/ast-dump-openmp-parallel.c @@ -5,13 +5,13 @@ void test() { ; } -// CHECK: TranslationUnitDecl 0x{{.*}} <> -// CHECK: `-FunctionDecl 0x{{.*}} <{{.*}}ast-dump-openmp-parallel.c:3:1, line:6:1> line:3:6 test 'void ()' -// CHECK-NEXT: `-CompoundStmt 0x{{.*}} -// CHECK-NEXT: `-OMPParallelDirective 0x{{.*}} -// CHECK-NEXT: `-CapturedStmt 0x{{.*}} -// CHECK-NEXT: `-CapturedDecl 0x{{.*}} <> nothrow -// CHECK-NEXT: |-NullStmt 0x{{.*}} openmp_structured_block -// CHECK-NEXT: |-ImplicitParamDecl 0x{{.*}} col:1 implicit .global_tid. 'const int *const restrict' -// CHECK-NEXT: |-ImplicitParamDecl 0x{{.*}} col:1 implicit .bound_tid. 'const int *const restrict' -// CHECK-NEXT: `-ImplicitParamDecl 0x{{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-parallel.c:4:1) *const restrict' +// CHECK: TranslationUnitDecl {{.*}} <> +// CHECK: `-FunctionDecl {{.*}} <{{.*}}ast-dump-openmp-parallel.c:3:1, line:6:1> line:3:6 test 'void ()' +// CHECK-NEXT: `-CompoundStmt {{.*}} +// CHECK-NEXT: `-OMPParallelDirective {{.*}} +// CHECK-NEXT: `-CapturedStmt {{.*}} +// CHECK-NEXT: `-CapturedDecl {{.*}} <> nothrow +// CHECK-NEXT: |-NullStmt {{.*}} openmp_structured_block +// CHECK-NEXT: |-ImplicitParamDecl {{.*}} col:1 implicit .global_tid. 'const int *const restrict' +// CHECK-NEXT: |-ImplicitParamDecl {{.*}} col:1 implicit .bound_tid. 'const int *const restrict' +// CHECK-NEXT: `-ImplicitParamDecl {{.*}} col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-parallel.c:4:1) *const restrict' diff --git a/clang/utils/make-ast-dump-check.sh b/clang/utils/make-ast-dump-check.sh new file mode 100755 index 000000000000..2a9cf40a884c --- /dev/null +++ b/clang/utils/make-ast-dump-check.sh @@ -0,0 +1,79 @@ +#! /bin/bash + +# This script is intended as a FileCheck replacement to update the test +# expectations in a -ast-dump test. +# +# Usage: +# +# $ lit -DFileCheck=$PWD/utils/make-ast-dump-check.sh test/AST/ast-dump-openmp-* + +prefix=CHECK + +while [[ "$#" -ne 0 ]]; do + case "$1" in + --check-prefix) + shift + prefix="$1" + ;; + --implicit-check-not) + shift + ;; + -*) + ;; + *) + file="$1" + ;; + esac + shift +done + +testdir="$(dirname "$file")" + +read -r -d '' script < "$file.new" + +mv "$file.new" "$file"