[clang][test][NFC] Also test for serialization in AST dump tests, part 3/n.
authorBruno Ricci <riccibrun@gmail.com>
Sun, 21 Jun 2020 12:49:27 +0000 (13:49 +0100)
committerBruno Ricci <riccibrun@gmail.com>
Sun, 21 Jun 2020 12:59:11 +0000 (13:59 +0100)
The outputs between the direct ast-dump test and the ast-dump test after
deserialization should match modulo a few differences.

For hand-written tests, strip the "<undeserialized declarations>"s and
the "imported"s with sed.

For tests generated with "make-ast-dump-check.sh", regenerate the output.

Part 3/n.

16 files changed:
clang/test/AST/atomic-expr.cpp
clang/test/AST/c-casts.c
clang/test/AST/category-attribute.m
clang/test/AST/coroutine-source-location-crash.cpp
clang/test/AST/deduction-guides.cpp
clang/test/AST/fixed_point.c
clang/test/AST/fixed_point_to_string.c
clang/test/AST/float16.cpp
clang/test/AST/implicit-cast-dump.c
clang/test/AST/language_address_space_attribute.cpp
clang/test/AST/multistep-explicit-cast.c
clang/test/AST/multistep-explicit-cast.cpp
clang/test/AST/pr43983.cpp
clang/test/AST/property-atomic-bool.m
clang/test/AST/template-implicit-vars.cpp
clang/test/AST/variadic-promotion.c

index e7fb6ba..db21d61 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 template<int N = 0>
 void pr43370() {
@@ -17,14 +24,14 @@ void useage(){
   foo();
 }
 
-// CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <{{[^,]+}}, line:7:1> line:4:6 pr43370
+// CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <{{[^,]+}}, line:{{.*}}:1> line:{{.*}}:6 pr43370
 // CHECK: AtomicExpr
 // CHECK-NEXT: ImplicitCastExpr
 // CHECK-SAME: <ArrayToPointerDecay>
 // CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:20> 'int [2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int [2]'
 // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:28> 'int' 5
 // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:25> 'int' 0
-// CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:4:1, line:7:1> line:4:6 used pr43370
+// CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 used pr43370
 // CHECK: AtomicExpr
 // CHECK-NEXT: ImplicitCastExpr
 // CHECK-SAME: <ArrayToPointerDecay>
@@ -32,7 +39,7 @@ void useage(){
 // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:28> 'int' 5
 // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:25> 'int' 0
 
-// CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <line:9:1, line:13:1> line:10:6 foo
+// CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 foo
 // CHECK: AtomicExpr
 // CHECK-NEXT: ImplicitCastExpr
 // CHECK-SAME: <ArrayToPointerDecay>
@@ -45,7 +52,7 @@ void useage(){
 // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:47> 'int' 1
 // CHECK-NEXT: ImplicitCastExpr
 // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:50> 'int' 0
-// CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:10:1, line:13:1> line:10:6 used foo
+// CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 used foo
 // CHECK: AtomicExpr
 // CHECK-NEXT: ImplicitCastExpr
 // CHECK-SAME: <ArrayToPointerDecay>
index c3a58ed..5eaa4aa 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -w -ast-dump %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -w -emit-pch -o %t %s
+// RUN: %clang_cc1 -w -x c -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 // The cast construction code both for implicit and c-style casts is very
 // different in C vs C++. This file is intended to test the C behavior.
index 7efe3df..e74f1a1 100644 (file)
@@ -1,5 +1,13 @@
+// Test without serialization:
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 // RUN: %clang_cc1 -fsyntax-only -ast-dump %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x objective-c -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
+//
 // expected-no-diagnostics
 
 __attribute__ ((external_source_symbol(language= "Swift", defined_in="A")))
index 04fb1d4..24fe3bc 100644 (file)
@@ -1,5 +1,14 @@
+// Test without serialization:
 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
 // RUN:    -fsyntax-only -ast-dump | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -std=c++14 -fcoroutines-ts -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple x86_64-apple-darwin9 -std=c++14 -fcoroutines-ts -include-pch %t \
+// RUN: -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
+
 #include "Inputs/std-coroutine.h"
 
 using namespace std::experimental;
index 0e9d275..0f5293b 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -fsyntax-only %s -ast-dump -std=c++17 | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -std=c++17 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -std=c++17 -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 namespace PR46111 {
 template <typename>
index 3a67718..62511ba 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -x c -ffixed-point -ast-dump %s | FileCheck %s --strict-whitespace
+//
+// Test with serialization:
+// RUN: %clang_cc1 -ffixed-point -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -ffixed-point -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s --strict-whitespace
 
 /*  Various contexts where type _Accum can appear. */
 
index ad71d10..8f4f370 100644 (file)
@@ -1,5 +1,17 @@
+// Tests without serialization:
 // RUN: %clang_cc1 -ast-dump -ffixed-point %s | FileCheck %s
 // RUN: %clang_cc1 -ast-dump -ffixed-point -fpadding-on-unsigned-fixed-point %s | FileCheck %s
+//
+// Tests with serialization:
+// RUN: %clang_cc1 -ffixed-point -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -ffixed-point -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
+//
+// RUN: %clang_cc1 -ffixed-point -fpadding-on-unsigned-fixed-point -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -ffixed-point -fpadding-on-unsigned-fixed-point -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 /**
  * Check the same values are printed in the AST regardless of if unsigned types
index 1704d35..c886aa9 100644 (file)
@@ -1,5 +1,20 @@
-// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu %s | FileCheck %s --strict-whitespace\r
-// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu -fnative-half-type %s | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace\r
+// Tests without serialization:\r
+// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu %s \\r
+// RUN: | FileCheck %s --strict-whitespace\r
+//\r
+// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu -fnative-half-type %s \\r
+// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace\r
+//\r
+// Tests with serialization:\r
+// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -emit-pch -o %t %s\r
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -include-pch %t -ast-dump-all /dev/null \\r
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \\r
+// RUN: | FileCheck %s --strict-whitespace\r
+//\r
+// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -emit-pch -o %t %s\r
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -include-pch %t -ast-dump-all /dev/null \\r
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \\r
+// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace\r
 \r
 /*  Various contexts where type _Float16 can appear. */\r
 \r
index 4cd855f..609ad2f 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 void foo1(void*);
 void foo2(void* const);
index f9ab461..fcf7503 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 %s -ast-dump | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 // Verify that the language address space attribute is
 // understood correctly by clang.
index aeb5919..7297b62 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -ast-dump %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple x86_64-linux-gnu -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 // We are checking that implicit casts don't get marked with 'part_of_explicit_cast',
 // while in explicit casts, the implicitly-inserted implicit casts are marked with 'part_of_explicit_cast'
index 5846679..d9dadde 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -ast-dump %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple x86_64-linux-gnu -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 // We are checking that implicit casts don't get marked with 'part_of_explicit_cast',
 // while in explicit casts, the implicitly-inserted implicit casts are marked with 'part_of_explicit_cast'
index 0f4f596..dd7ce76 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -fsyntax-only %s -ast-dump | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 struct B { _Alignas(64) struct { int b; };   };
 
index 4110b5e..31cfacc 100644 (file)
@@ -1,4 +1,12 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -ast-dump "%s" | FileCheck %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -ast-dump "%s" \
+// RUN: | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -emit-pch -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -x objective-c -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 // CHECK: TypedefDecl {{.*}} referenced AtomicBool '_Atomic(_Bool)'
 // CHECK:  AtomicType {{.*}} '_Atomic(_Bool)'
index 25d35fb..fb3e45d 100644 (file)
@@ -1,4 +1,12 @@
+// Test without serialization:
 // RUN: %clang_cc1 -fsyntax-only %s -std=c++11 -ast-dump | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
+
 template<typename T>
 void f(T t) {
   T a[] = {t};
index 01d8e93..41c7fec 100644 (file)
@@ -1,4 +1,11 @@
+// Test without serialization:
 // RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 void variadic(int, ...);