diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
commit | b35a2aa71f76a334a9c98c0a3c3995b5d902d2b9 (patch) | |
tree | cdff4a5d1a715d4ad622fd8f190128b54bebe440 /test/ASTMerge/struct | |
parent | 3748d41833787fcbf59cc5624e8d2b042a8991bc (diff) | |
parent | 741e05796da92b46d4f7bcbee00702ff37df6489 (diff) |
Creating branches/google/stable and tags/google/stable/2019-05-14 from r360103upstream/google/stable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/stable@360714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ASTMerge/struct')
-rw-r--r-- | test/ASTMerge/struct/Inputs/struct1.c | 141 | ||||
-rw-r--r-- | test/ASTMerge/struct/Inputs/struct2.c | 138 | ||||
-rw-r--r-- | test/ASTMerge/struct/test.c | 55 |
3 files changed, 0 insertions, 334 deletions
diff --git a/test/ASTMerge/struct/Inputs/struct1.c b/test/ASTMerge/struct/Inputs/struct1.c deleted file mode 100644 index a85aec70a8..0000000000 --- a/test/ASTMerge/struct/Inputs/struct1.c +++ /dev/null @@ -1,141 +0,0 @@ -typedef int Int; -typedef float Float; - -// Matches -struct S0 { - Int field1; - Float field2; -}; - -struct S0 x0; - -// Mismatch in field type -struct S1 { - Int field1; - int field2; -}; - -struct S1 x1; - -// Mismatch in tag kind. -struct S2 { int i; float f; } x2; - -// Missing fields -struct S3 { int i; float f; double d; } x3; - -// Extra fields -struct S4 { int i; } x4; - -// Bit-field matches -struct S5 { int i : 8; unsigned j : 8; } x5; - -// Bit-field mismatch -struct S6 { int i : 8; unsigned j : 8; } x6; - -// Bit-field mismatch -struct S7 { int i : 8; unsigned j : 8; } x7; - -// Incomplete type -struct S8 *x8; - -// Incomplete type -struct S9 { int i; float f; } *x9; - -// Incomplete type -struct S10 *x10; - -// Matches -struct ListNode { - int value; - struct ListNode *Next; -} xList; - -// Mismatch due to struct used internally -struct DeepError { - int value; - struct DeeperError { int i; int f; } *Deeper; -} xDeep; - -// Matches -struct { - Int i; - float f; -} x11; - -// Matches -typedef struct { - Int i; - float f; -} S12; - -S12 x12; - -// Mismatch -typedef struct { - Float i; // Mismatch here. - float f; -} S13; - -S13 x13; - -// Matches -struct Unnamed { - union { - struct { - int i; - } S; - struct { - float i; - } R; - } U; -} x14; - -// Matches -struct DeepUnnamed { - union { - union { - struct { - long i; - } S; - struct { - int i; - } R; - } U1; - union { - struct { - long i; - } S; - struct { - float i; - } T; - } U2; - } U; - struct { - long i; - } V; -} x15; - -// Mismatch due to unnamed struct used internally -struct DeepUnnamedError { - union { - union { - struct { - long i; - } S; - struct { - int i; - } R; - } U1; - union { - struct { - long i; // Mismatch here. - } S; - struct { - float i; - } T; - } U2; - } U; - struct { - long i; - } V; -} x16; diff --git a/test/ASTMerge/struct/Inputs/struct2.c b/test/ASTMerge/struct/Inputs/struct2.c deleted file mode 100644 index 49fe36d823..0000000000 --- a/test/ASTMerge/struct/Inputs/struct2.c +++ /dev/null @@ -1,138 +0,0 @@ -// Matches -struct S0 { - int field1; - float field2; -}; - -struct S0 x0; - -// Mismatch in field type -struct S1 { - int field1; - float field2; -}; - -struct S1 x1; - -// Mismatch in tag kind. -union S2 { int i; float f; } x2; - -// Missing fields -struct S3 { int i; float f; } x3; - -// Extra fields -struct S4 { int i; float f; } x4; - -// Bit-field matches -struct S5 { int i : 8; unsigned j : 8; } x5; - -// Bit-field mismatch -struct S6 { int i : 8; unsigned j; } x6; - -// Bit-field mismatch -struct S7 { int i : 8; unsigned j : 16; } x7; - -// Incomplete type -struct S8 { int i; float f; } *x8; - -// Incomplete type -struct S9 *x9; - -// Incomplete type -struct S10 *x10; - -// Matches -struct ListNode { - int value; - struct ListNode *Next; -} xList; - -// Mismatch due to struct used internally -struct DeepError { - int value; - struct DeeperError { int i; float f; } *Deeper; -} xDeep; - -// Matches -struct { - int i; - float f; -} x11; - -// Matches -typedef struct { - int i; - float f; -} S12; - -S12 x12; - -// Mismatch -typedef struct { - int i; // Mismatch here. - float f; -} S13; - -S13 x13; - -// Matches -struct Unnamed { - union { - struct { - int i; - } S; - struct { - float i; - } R; - } U; -} x14; - -// Matches -struct DeepUnnamed { - union { - union { - struct { - long i; - } S; - struct { - int i; - } R; - } U1; - union { - struct { - long i; - } S; - struct { - float i; - } T; - } U2; - } U; - struct { - long i; - } V; -} x15; - -// Mismatch due to unnamed struct used internally -struct DeepUnnamedError { - union { - union { - struct { - long i; - } S; - struct { - int i; - } R; - } U1; - union { - struct { - float i; // Mismatch here. - } S; - struct { - float i; - } T; - } U2; - } U; - struct { - long i; - } V; -} x16; diff --git a/test/ASTMerge/struct/test.c b/test/ASTMerge/struct/test.c deleted file mode 100644 index ef33939697..0000000000 --- a/test/ASTMerge/struct/test.c +++ /dev/null @@ -1,55 +0,0 @@ -// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/struct1.c -// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/struct2.c -// RUN: not %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s - -// CHECK: struct1.c:13:8: warning: type 'struct S1' has incompatible definitions in different translation units -// CHECK: struct1.c:15:7: note: field 'field2' has type 'int' here -// CHECK: struct2.c:12:9: note: field 'field2' has type 'float' here -// CHECK: struct2.c:15:11: error: external variable 'x1' declared with incompatible types in different translation units ('struct S1' vs. 'struct S1') -// CHECK: struct1.c:18:11: note: declared here with type 'struct S1' -// CHECK: struct1.c:21:8: warning: type 'struct S2' has incompatible definitions in different translation units -// CHECK: struct2.c:18:7: note: 'S2' is a union here -// CHECK: struct2.c:18:30: error: external variable 'x2' declared with incompatible types in different translation units ('union S2' vs. 'struct S2') -// CHECK: struct1.c:21:31: note: declared here with type 'struct S2' -// CHECK: struct1.c:24:8: warning: type 'struct S3' has incompatible definitions in different translation units -// CHECK: struct1.c:24:36: note: field 'd' has type 'double' here -// CHECK: struct2.c:21:8: note: no corresponding field here -// CHECK: struct2.c:21:31: error: external variable 'x3' declared with incompatible types in different translation units ('struct S3' vs. 'struct S3') -// CHECK: struct1.c:24:41: note: declared here with type 'struct S3' -// CHECK: struct1.c:27:8: warning: type 'struct S4' has incompatible definitions in different translation units -// CHECK: struct2.c:24:26: note: field 'f' has type 'float' here -// CHECK: struct1.c:27:8: note: no corresponding field here -// CHECK: struct2.c:24:31: error: external variable 'x4' declared with incompatible types in different translation units ('struct S4' vs. 'struct S4') -// CHECK: struct1.c:27:22: note: declared here with type 'struct S4' -// CHECK: struct1.c:33:8: warning: type 'struct S6' has incompatible definitions in different translation units -// CHECK: struct1.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 8 here -// CHECK: struct2.c:30:33: note: field 'j' is not a bit-field -// CHECK: struct2.c:30:38: error: external variable 'x6' declared with incompatible types in different translation units ('struct S6' vs. 'struct S6') -// CHECK: struct1.c:33:42: note: declared here with type 'struct S6' -// CHECK: struct1.c:36:8: warning: type 'struct S7' has incompatible definitions in different translation units -// CHECK: struct1.c:36:33: note: bit-field 'j' with type 'unsigned int' and length 8 here -// CHECK: struct2.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 16 here -// CHECK: struct2.c:33:43: error: external variable 'x7' declared with incompatible types in different translation units ('struct S7' vs. 'struct S7') -// CHECK: struct1.c:36:42: note: declared here with type 'struct S7' -// CHECK: struct1.c:56:10: warning: type 'struct DeeperError' has incompatible definitions in different translation units -// CHECK: struct1.c:56:35: note: field 'f' has type 'int' here -// CHECK: struct2.c:53:37: note: field 'f' has type 'float' here -// CHECK: struct1.c:54:8: warning: type 'struct DeepError' has incompatible definitions in different translation units -// CHECK: struct1.c:56:41: note: field 'Deeper' has type 'struct DeeperError *' here -// CHECK: struct2.c:53:43: note: field 'Deeper' has type 'struct DeeperError *' here -// CHECK: struct2.c:54:3: error: external variable 'xDeep' declared with incompatible types in different translation units ('struct DeepError' vs. 'struct DeepError') -// CHECK: struct1.c:57:3: note: declared here with type 'struct DeepError' -// CHECK: struct1.c:74:9: warning: type 'S13' has incompatible definitions in different translation units -// CHECK: struct1.c:75:9: note: field 'i' has type 'Float' (aka 'float') here -// CHECK: struct2.c:72:7: note: field 'i' has type 'int' here -// CHECK: struct2.c:76:5: error: external variable 'x13' declared with incompatible types in different translation units ('S13' vs. 'S13') -// CHECK: struct1.c:79:5: note: declared here with type 'S13' -// CHECK: struct1.c:130:7: warning: type 'struct DeepUnnamedError::(anonymous at [[PATH_TO_INPUTS:.+]]struct1.c:130:7)' has incompatible definitions in different translation units -// CHECK: struct1.c:131:14: note: field 'i' has type 'long' here -// CHECK: struct2.c:128:15: note: field 'i' has type 'float' here -// CHECK: struct1.c:129:5: warning: type 'union DeepUnnamedError::(anonymous at [[PATH_TO_INPUTS]]struct1.c:129:5)' has incompatible definitions in different translation units -// CHECK: struct1.c:132:9: note: field 'S' has type 'struct (anonymous struct at [[PATH_TO_INPUTS]]struct1.c:130:7)' here -// CHECK: struct2.c:129:9: note: field 'S' has type 'struct (anonymous struct at [[PATH_TO_INPUTS]]struct2.c:127:7)' here -// CHECK: struct2.c:138:3: error: external variable 'x16' declared with incompatible types in different translation units ('struct DeepUnnamedError' vs. 'struct DeepUnnamedError') -// CHECK: struct1.c:141:3: note: declared here with type 'struct DeepUnnamedError' -// CHECK: 11 warnings and 9 errors generated |