OSDN Git Service

[clang][test][NFC] Also test for serialization in AST dump tests, part 2/n.
authorBruno Ricci <riccibrun@gmail.com>
Sun, 21 Jun 2020 12:35:15 +0000 (13:35 +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 2/n.

17 files changed:
clang/test/AST/address_space_attribute.cpp
clang/test/AST/alignas_maybe_odr_cleanup.cpp
clang/test/AST/ast-dump-aarch64-sve-types.c
clang/test/AST/ast-dump-arm-attr.c
clang/test/AST/ast-dump-array.cpp
clang/test/AST/ast-dump-attr.cpp
clang/test/AST/ast-dump-attr.m
clang/test/AST/ast-dump-c-attr.c
clang/test/AST/ast-dump-decl-stmts.cpp
clang/test/AST/ast-dump-decl.c
clang/test/AST/ast-dump-decl.cpp
clang/test/AST/ast-dump-decl.m
clang/test/AST/ast-dump-decl.mm
clang/test/AST/ast-dump-expr.c
clang/test/AST/ast-dump-expr.cpp
clang/test/AST/ast-dump-funcs.cpp
clang/test/AST/ast-dump-msp430-attr.c

index 554c9ba..50777dd 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
 
 // Veryify the ordering of the address_space attribute still comes before the
 // type whereas other attributes are still printed after.
index ebc0908..cdff1bf 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 FOO {
   static const int vec_align_bytes = 32;
index a522164..bfb8bc2 100644 (file)
@@ -1,5 +1,13 @@
+// Test without serialization:
 // RUN: %clang_cc1 -triple aarch64-linux-gnu -ast-dump \
 // RUN:   -ast-dump-filter __SV %s | FileCheck %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple aarch64-linux-gnu -include-pch %t \
+// RUN: -ast-dump-all -ast-dump-filter __SV /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s
 
 // CHECK: TypedefDecl {{.*}} implicit __SVInt8_t '__SVInt8_t'
 // CHECK-NEXT: -BuiltinType {{.*}} '__SVInt8_t'
index 82a7976..78f557d 100644 (file)
@@ -1,5 +1,20 @@
-// RUN: %clang_cc1 -triple arm-apple-darwin -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
-// RUN: %clang_cc1 -triple armv8m.base-none-eabi -mcmse -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s --check-prefix=CHECK-CMSE
+// Tests without serialization:
+// RUN: %clang_cc1 -triple arm-apple-darwin -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// RUN: %clang_cc1 -triple armv8m.base-none-eabi -mcmse -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s --check-prefix=CHECK-CMSE
+//
+// Tests with serialization:
+// RUN: %clang_cc1 -triple arm-apple-darwin -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple arm-apple-darwin -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// RUN: %clang_cc1 -triple armv8m.base-none-eabi -mcmse -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple armv8m.base-none-eabi -mcmse -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 __attribute__((interrupt)) void Test(void);
 // CHECK: FunctionDecl{{.*}}Test
index bfea135..fe7875e 100644 (file)
@@ -1,4 +1,12 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 void testArrayInitExpr()
 {
index 83c4a63..50eef3e 100644 (file)
@@ -1,4 +1,13 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++11 -Wno-deprecated-declarations -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s\r
+// Test without serialization:\r
+// RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++11 -Wno-deprecated-declarations -ast-dump -ast-dump-filter Test %s \\r
+// RUN: | FileCheck --strict-whitespace %s\r
+//\r
+// Test with serialization:\r
+// RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++11 -Wno-deprecated-declarations -emit-pch -o %t %s\r
+// RUN: %clang_cc1 -x c++ -triple x86_64-pc-linux -std=c++11 -Wno-deprecated-declarations \\r
+// RUN: -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \\r
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \\r
+// RUN: | FileCheck --strict-whitespace %s\r
 \r
 int TestLocation\r
 __attribute__((unused));\r
index 8775d40..c7b133d 100644 (file)
@@ -1,4 +1,15 @@
-// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s\r
+// Test without serialization:\r
+// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \\r
+// RUN: -ast-dump -ast-dump-filter Test %s \\r
+// RUN: | FileCheck --strict-whitespace %s\r
+//\r
+// Test with serialization:\r
+// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \\r
+// RUN: -emit-pch -o %t %s\r
+// RUN: %clang_cc1 -x objective-c -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \\r
+// RUN: -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \\r
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \\r
+// RUN: | FileCheck --strict-whitespace %s\r
 \r
 @interface NSObject\r
 @end\r
index 8452b79..c40a233 100644 (file)
@@ -1,4 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes -Wno-deprecated-declarations -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s\r
+// Test without serialization:\r
+// RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \\r
+// RUN: -Wno-deprecated-declarations -ast-dump -ast-dump-filter Test %s \\r
+// RUN: | FileCheck --strict-whitespace %s\r
+//\r
+// Test with serialization:\r
+// RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \\r
+// RUN: -Wno-deprecated-declarations -emit-pch -o %t %s\r
+// RUN: %clang_cc1 -x c -triple x86_64-pc-linux -fdouble-square-bracket-attributes \\r
+// RUN: -Wno-deprecated-declarations -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \\r
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \\r
+// RUN: | FileCheck --strict-whitespace %s\r
 \r
 int Test1 [[deprecated]];\r
 // CHECK:      VarDecl{{.*}}Test1\r
index 3705bc5..613a3f9 100644 (file)
@@ -1,4 +1,12 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 void test_func() {
   int a, b, c;
index b58f9bc..0d6ef76 100644 (file)
@@ -1,6 +1,21 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -check-prefix CHECK-TU -strict-whitespace %s
-// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodule-name=X -triple x86_64-unknown-unknown -fmodule-map-file=%S/Inputs/module.modulemap -ast-dump -ast-dump-filter Test %s -DMODULES | FileCheck -check-prefix CHECK -check-prefix CHECK-MODULES -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple x86_64-unknown-unknown -include-pch %t \
+// RUN: -ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s \
+// RUN: | FileCheck -check-prefix CHECK-TU --strict-whitespace %s
+//
+// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodule-name=X \
+// RUN: -triple x86_64-unknown-unknown -fmodule-map-file=%S/Inputs/module.modulemap \
+// RUN: -ast-dump -ast-dump-filter Test %s -DMODULES \
+// RUN: | FileCheck -check-prefix CHECK -check-prefix CHECK-MODULES --strict-whitespace %s
 
 int TestLocation;
 // CHECK: VarDecl 0x{{[^ ]*}} <{{.*}}:[[@LINE-1]]:1, col:5> col:5 TestLocation
index 1199ad7..3809683 100644 (file)
@@ -1,4 +1,14 @@
-// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s\r
+// Test without serialization:\r
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions \\r
+// RUN: -ast-dump -ast-dump-filter Test %s \\r
+// RUN: | FileCheck --strict-whitespace %s\r
+//\r
+// Test with serialization: FIXME: Find why the outputs differs and fix it!\r
+//    : %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -emit-pch -o %t %s\r
+//    : %clang_cc1 -x c++ -std=c++11 -triple x86_64-linux-gnu -fms-extensions -include-pch %t \\r
+//    : -ast-dump-all -ast-dump-filter Test /dev/null \\r
+//    : | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \\r
+//    : | FileCheck --strict-whitespace %s\r
 \r
 class testEnumDecl {\r
   enum class TestEnumDeclScoped;\r
@@ -325,7 +335,7 @@ namespace testClassTemplateDecl {
 // CHECK-NEXT:  |-CXXRecordDecl 0x{{.+}} <col:14, col:20> col:20 implicit class TestClassTemplate\r
 // CHECK-NEXT:  `-FieldDecl 0x{{.+}} <line:[[@LINE-74]]:5, col:9> col:9 j 'int'\r
 \r
-// CHECK:       ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:256:3, col:44> col:25 class TestClassTemplate definition\r
+// CHECK:       ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:44> col:25 class TestClassTemplate definition\r
 // CHECK-NEXT:  |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init\r
 // CHECK-NEXT:  | |-DefaultConstructor exists non_trivial user_provided\r
 // CHECK-NEXT:  | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param\r
@@ -411,18 +421,18 @@ namespace testClassTemplateDecl {
 // CHECK-NEXT:  |     `-IntegerLiteral 0x{{.+}} <col:20> 'int' 42\r
 // CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 struct TestTemplateDefaultNonType\r
 \r
-// CHECK:       ClassTemplateDecl 0x{{.+}} <{{.+}}:275:3, col:68> col:68 TestTemplateTemplateDefaultType\r
+// CHECK:       ClassTemplateDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:68> col:68 TestTemplateTemplateDefaultType\r
 // CHECK-NEXT:  |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:42> col:37 depth 0 index 0 TT\r
 // CHECK-NEXT:  | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0\r
 // CHECK-NEXT:  | `-TemplateArgument <col:42> template TestClassTemplate\r
 // CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} <col:61, col:68> col:68 struct TestTemplateTemplateDefaultType\r
 \r
-// CHECK:       ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:276:3, col:82> col:48 TestTemplateTemplateDefaultType\r
+// CHECK:       ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:{{.*}}:3, col:82> col:48 TestTemplateTemplateDefaultType\r
 // CHECK-NEXT:  |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:37> col:37 depth 0 index 0 TT\r
 // CHECK-NEXT:  | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0\r
-// CHECK-NEXT:  | `-TemplateArgument <line:275:42> template TestClassTemplate\r
+// CHECK-NEXT:  | `-TemplateArgument <line:{{.*}}:42> template TestClassTemplate\r
 // CHECK-NEXT:  |   `-inherited from TemplateTemplateParm 0x{{.+}} 'TT'\r
-// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:276:41, col:82> col:48 struct TestTemplateTemplateDefaultType definition\r
+// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:{{.*}}:41, col:82> col:48 struct TestTemplateTemplateDefaultType definition\r
 // CHECK-NEXT:    |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init\r
 // CHECK-NEXT:    | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr\r
 // CHECK-NEXT:    | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param\r
index 6cef989..1e9332b 100644 (file)
@@ -1,4 +1,13 @@
-// RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -Wno-unused -fblocks -emit-pch -o %t %s
+// RUN: %clang_cc1 -x objective-c -Wno-unused -fblocks -include-pch %t \
+// RUN: -ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 @protocol P
 @end
index efe3568..7dc60e1 100644 (file)
@@ -1,4 +1,13 @@
-// RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -Wno-unused -fblocks -emit-pch -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -Wno-unused -fblocks -include-pch %t \
+// RUN: -ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 @interface A
 @end
index 6011ab7..1cb8cea 100644 (file)
@@ -1,4 +1,13 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu11 -ast-dump %s | FileCheck -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu11 -ast-dump %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple x86_64-unknown-unknown -Wno-unused-value -std=gnu11 \
+// RUN: -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 void Comma(void) {
   1, 2, 3;
index d52caf3..33b00f6 100644 (file)
@@ -1,4 +1,13 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -ast-dump %s | FileCheck -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -ast-dump %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 \
+// RUN: -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 namespace std {
 using size_t = decltype(sizeof(0));
index 62afcc6..61fb5d4 100644 (file)
@@ -1,4 +1,12 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 struct R {
   R() = default;
index 3ccb3bd..f228cd8 100644 (file)
@@ -1,4 +1,12 @@
-// RUN: %clang_cc1 -triple msp430-unknown-unknown -ast-dump -ast-dump-filter Test %s | FileCheck --strict-whitespace %s
+// Test without serialization:
+// RUN: %clang_cc1 -triple msp430-unknown-unknown -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -triple msp430-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple msp430-unknown-unknown -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck --strict-whitespace %s
 
 __attribute__((interrupt(12))) void Test(void);
 // CHECK: FunctionDecl{{.*}}Test