aboutsummaryrefslogtreecommitdiff
path: root/test/ASTMerge
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-15 22:01:00 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-15 22:01:00 +0000
commit73dc30b71e218ba2b776b10d07dc2aff09cb2c47 (patch)
tree99011f1c2fbaa0a9d519ca3343001b198d812e77 /test/ASTMerge
parent25760611365be23556b32332f8a66ae21ea93ecf (diff)
Reimplement the structural-equality checks used to determine whether
two types in different AST contexts are equivalent. Rather than transforming the type from one context into the other context, we perform a deep structural comparison of the types. This change addresses a serious problem with recursive data types like struct ListNode { int value; struct ListNode *Next; } xList; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ASTMerge')
-rw-r--r--test/ASTMerge/Inputs/struct1.c10
-rw-r--r--test/ASTMerge/Inputs/struct2.c6
-rw-r--r--test/ASTMerge/struct.c7
3 files changed, 19 insertions, 4 deletions
diff --git a/test/ASTMerge/Inputs/struct1.c b/test/ASTMerge/Inputs/struct1.c
index 10c8fce42a..e6d71ac1b4 100644
--- a/test/ASTMerge/Inputs/struct1.c
+++ b/test/ASTMerge/Inputs/struct1.c
@@ -44,10 +44,14 @@ struct S9 { int i; float f; } *x9;
// Incomplete type
struct S10 *x10;
-// FIXME: Matches, but crashes the importer
-#if 0
+// Matches
struct ListNode {
int value;
struct ListNode *Next;
} xList;
-#endif
+
+// Mismatch due to struct used internally
+struct DeepError {
+ int value;
+ struct DeeperError { int i; int f; } *Deeper;
+} xDeep;
diff --git a/test/ASTMerge/Inputs/struct2.c b/test/ASTMerge/Inputs/struct2.c
index 655efd43db..402283137a 100644
--- a/test/ASTMerge/Inputs/struct2.c
+++ b/test/ASTMerge/Inputs/struct2.c
@@ -46,3 +46,9 @@ 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;
diff --git a/test/ASTMerge/struct.c b/test/ASTMerge/struct.c
index c6e57185ab..d71436f2fc 100644
--- a/test/ASTMerge/struct.c
+++ b/test/ASTMerge/struct.c
@@ -31,4 +31,9 @@
// 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: 29 diagnostics
+// 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: 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: 37 diagnostics