[clang] cddc999 - [clang][test][NFC] Also test for serialization in AST dump tests, part 3/n.

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 21 06:03:11 PDT 2020


Author: Bruno Ricci
Date: 2020-06-21T13:59:11+01:00
New Revision: cddc9993eafd76f08989beea037d085521d48127

URL: https://github.com/llvm/llvm-project/commit/cddc9993eafd76f08989beea037d085521d48127
DIFF: https://github.com/llvm/llvm-project/commit/cddc9993eafd76f08989beea037d085521d48127.diff

LOG: [clang][test][NFC] Also test for serialization in AST dump tests, part 3/n.

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.

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/atomic-expr.cpp b/clang/test/AST/atomic-expr.cpp
index e7fb6ba833e5..db21d61e98c2 100644
--- a/clang/test/AST/atomic-expr.cpp
+++ b/clang/test/AST/atomic-expr.cpp
@@ -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>

diff  --git a/clang/test/AST/c-casts.c b/clang/test/AST/c-casts.c
index c3a58ed8274c..5eaa4aaf2345 100644
--- a/clang/test/AST/c-casts.c
+++ b/clang/test/AST/c-casts.c
@@ -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
 // 
diff erent in C vs C++. This file is intended to test the C behavior.

diff  --git a/clang/test/AST/category-attribute.m b/clang/test/AST/category-attribute.m
index 7efe3df00ec8..e74f1a1ffbc1 100644
--- a/clang/test/AST/category-attribute.m
+++ b/clang/test/AST/category-attribute.m
@@ -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")))

diff  --git a/clang/test/AST/coroutine-source-location-crash.cpp b/clang/test/AST/coroutine-source-location-crash.cpp
index 04fb1d45c524..24fe3bcb224e 100644
--- a/clang/test/AST/coroutine-source-location-crash.cpp
+++ b/clang/test/AST/coroutine-source-location-crash.cpp
@@ -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;

diff  --git a/clang/test/AST/deduction-guides.cpp b/clang/test/AST/deduction-guides.cpp
index 0e9d2754f865..0f5293bc063d 100644
--- a/clang/test/AST/deduction-guides.cpp
+++ b/clang/test/AST/deduction-guides.cpp
@@ -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>

diff  --git a/clang/test/AST/fixed_point.c b/clang/test/AST/fixed_point.c
index 3a67718fba8e..62511ba701fe 100644
--- a/clang/test/AST/fixed_point.c
+++ b/clang/test/AST/fixed_point.c
@@ -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. */
 

diff  --git a/clang/test/AST/fixed_point_to_string.c b/clang/test/AST/fixed_point_to_string.c
index ad71d1024f53..8f4f3703ef6f 100644
--- a/clang/test/AST/fixed_point_to_string.c
+++ b/clang/test/AST/fixed_point_to_string.c
@@ -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

diff  --git a/clang/test/AST/float16.cpp b/clang/test/AST/float16.cpp
index 1704d35a7718..c886aa9cf0f1 100644
--- a/clang/test/AST/float16.cpp
+++ b/clang/test/AST/float16.cpp
@@ -1,5 +1,20 @@
-// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu %s | FileCheck %s --strict-whitespace
-// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu -fnative-half-type %s | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
+// Tests without serialization:
+// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu %s \
+// RUN: | FileCheck %s --strict-whitespace
+//
+// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu -fnative-half-type %s \
+// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
+//
+// Tests with serialization:
+// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s --strict-whitespace
+//
+// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
 
 /*  Various contexts where type _Float16 can appear. */
 

diff  --git a/clang/test/AST/implicit-cast-dump.c b/clang/test/AST/implicit-cast-dump.c
index 4cd855fb1d46..609ad2f6d4d8 100644
--- a/clang/test/AST/implicit-cast-dump.c
+++ b/clang/test/AST/implicit-cast-dump.c
@@ -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);

diff  --git a/clang/test/AST/language_address_space_attribute.cpp b/clang/test/AST/language_address_space_attribute.cpp
index f9ab4612320b..fcf7503302f9 100644
--- a/clang/test/AST/language_address_space_attribute.cpp
+++ b/clang/test/AST/language_address_space_attribute.cpp
@@ -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.

diff  --git a/clang/test/AST/multistep-explicit-cast.c b/clang/test/AST/multistep-explicit-cast.c
index aeb591961812..7297b6285186 100644
--- a/clang/test/AST/multistep-explicit-cast.c
+++ b/clang/test/AST/multistep-explicit-cast.c
@@ -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'

diff  --git a/clang/test/AST/multistep-explicit-cast.cpp b/clang/test/AST/multistep-explicit-cast.cpp
index 58466791354c..d9dadde5539c 100644
--- a/clang/test/AST/multistep-explicit-cast.cpp
+++ b/clang/test/AST/multistep-explicit-cast.cpp
@@ -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'

diff  --git a/clang/test/AST/pr43983.cpp b/clang/test/AST/pr43983.cpp
index 0f4f596361aa..dd7ce76a38bc 100644
--- a/clang/test/AST/pr43983.cpp
+++ b/clang/test/AST/pr43983.cpp
@@ -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; };   };
 

diff  --git a/clang/test/AST/property-atomic-bool.m b/clang/test/AST/property-atomic-bool.m
index 4110b5e04459..31cfacc749c4 100644
--- a/clang/test/AST/property-atomic-bool.m
+++ b/clang/test/AST/property-atomic-bool.m
@@ -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)'

diff  --git a/clang/test/AST/template-implicit-vars.cpp b/clang/test/AST/template-implicit-vars.cpp
index 25d35fbdb84f..fb3e45d77e05 100644
--- a/clang/test/AST/template-implicit-vars.cpp
+++ b/clang/test/AST/template-implicit-vars.cpp
@@ -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};

diff  --git a/clang/test/AST/variadic-promotion.c b/clang/test/AST/variadic-promotion.c
index 01d8e934b4eb..41c7fec8d794 100644
--- a/clang/test/AST/variadic-promotion.c
+++ b/clang/test/AST/variadic-promotion.c
@@ -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, ...);
 


        


More information about the cfe-commits mailing list