r348469 - Make test resistant to line numbers changing

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 6 04:45:26 PST 2018


On Thu, Dec 6, 2018 at 4:25 AM Stephen Kelly via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: steveire
> Date: Thu Dec  6 01:22:12 2018
> New Revision: 348469
>
> URL: http://llvm.org/viewvc/llvm-project?rev=348469&view=rev
> Log:
> Make test resistant to line numbers changing

I would prefer to see the line numbers be tested rather than entirely
ignored (it's still important information we want to make sure is
correct). Can you use [[@LINE + N]] to instead make the line numbers
relative?

~Aaron

>
> Modified:
>     cfe/trunk/test/AST/dump.cpp
>
> Modified: cfe/trunk/test/AST/dump.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/dump.cpp?rev=348469&r1=348468&r2=348469&view=diff
> ==============================================================================
> --- cfe/trunk/test/AST/dump.cpp (original)
> +++ cfe/trunk/test/AST/dump.cpp Thu Dec  6 01:22:12 2018
> @@ -43,7 +43,7 @@ struct S {
>    }
>  };
>
> -// CHECK:      |     `-OMPParallelForDirective {{.+}} {{<line:40:9, col:80>|<col:9, col:80>}}
> +// CHECK:      |     `-OMPParallelForDirective {{.+}} {{<line:.+:9, col:80>|<col:9, col:80>}}
>  // CHECK-NEXT: |       |-OMPDefaultClause {{.+}} <col:26, col:38>
>  // CHECK-NEXT: |       |-OMPPrivateClause {{.+}} <col:40, col:49>
>  // CHECK-NEXT: |       | `-DeclRefExpr {{.+}} <col:48> 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
> @@ -53,19 +53,19 @@ struct S {
>  // CHECK-NEXT: |       |-OMPScheduleClause {{.+}} <col:61, col:79>
>  // CHECK-NEXT: |       | `-ImplicitCastExpr {{.+}} <col:78> 'int' <LValueToRValue>
>  // CHECK-NEXT: |       |   `-DeclRefExpr {{.+}} <col:78> 'int' lvalue OMPCapturedExpr {{.+}} '.capture_expr.' 'int'
> -// CHECK-NEXT: |       `-CapturedStmt {{.+}} <line:41:5, line:42:9>
> +// CHECK-NEXT: |       `-CapturedStmt {{.+}} <line:{{.+}}:5, line:{{.+}}:9>
>  // CHECK-NEXT: |         |-CapturedDecl {{.+}} <<invalid sloc>> <invalid sloc>
> -// CHECK-NEXT: |         | |-ForStmt {{.+}} <line:41:5, line:42:9>
> -// CHECK:      |         | | `-UnaryOperator {{.+}} <line:42:7, col:9> 'int' lvalue prefix '++'
> +// CHECK-NEXT: |         | |-ForStmt {{.+}} <line:{{.+}}:5, line:{{.+}}:9>
> +// CHECK:      |         | | `-UnaryOperator {{.+}} <line:{{.+}}:7, col:9> 'int' lvalue prefix '++'
>  // CHECK-NEXT: |         | |   `-DeclRefExpr {{.+}} <col:9> 'int' lvalue OMPCapturedExpr {{.+}} 'a' 'int &'
>
>  #pragma omp declare simd
>  #pragma omp declare simd inbranch
>  void foo();
>
> -// CHECK:        |-FunctionDecl {{.+}} <line:64:1, col:10> col:6 foo 'void ()'
> -// CHECK-NEXT:   |-OMPDeclareSimdDeclAttr {{.+}} <line:63:9, col:34> Implicit BS_Inbranch
> -// CHECK:        `-OMPDeclareSimdDeclAttr {{.+}} <line:62:9, col:25> Implicit BS_Undefined
> +// CHECK:        |-FunctionDecl {{.+}} <line:{{.+}}:1, col:10> col:6 foo 'void ()'
> +// CHECK-NEXT:   |-OMPDeclareSimdDeclAttr {{.+}} <line:{{.+}}:9, col:34> Implicit BS_Inbranch
> +// CHECK:        `-OMPDeclareSimdDeclAttr {{.+}} <line:{{.+}}:9, col:25> Implicit BS_Undefined
>
>  #pragma omp declare target
>  int bar() {
> @@ -74,11 +74,11 @@ int bar() {
>  }
>  #pragma omp end declare target
>
> -// CHECK:       `-FunctionDecl {{.+}} <line:71:1, line:74:1> line:71:5 bar 'int ()'
> -// CHECK-NEXT:  |-CompoundStmt {{.+}} <col:11, line:74:1>
> -// CHECK-NEXT:  | |-DeclStmt {{.+}} <line:72:3, col:8>
> +// CHECK:       `-FunctionDecl {{.+}} <line:{{.+}}:1, line:{{.+}}:1> line:{{.+}}:5 bar 'int ()'
> +// CHECK-NEXT:  |-CompoundStmt {{.+}} <col:11, line:{{.+}}:1>
> +// CHECK-NEXT:  | |-DeclStmt {{.+}} <line:{{.+}}:3, col:8>
>  // CHECK-NEXT:  | | `-VarDecl {{.+}} <col:3, col:7> col:7 used f 'int'
> -// CHECK-NEXT:  | `-ReturnStmt {{.+}} <line:73:3, col:10>
> +// CHECK-NEXT:  | `-ReturnStmt {{.+}} <line:{{.+}}:3, col:10>
>  // CHECK-NEXT:  |   `-ImplicitCastExpr {{.+}} <col:10> 'int' <LValueToRValue>
>  // CHECK-NEXT:  |     `-DeclRefExpr {{.+}} <col:10> 'int' lvalue Var {{.+}} 'f' 'int'
>  // CHECK-NEXT:  `-OMPDeclareTargetDeclAttr {{.+}} <<invalid sloc>> Implicit MT_To
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list