summaryrefslogtreecommitdiffstats
path: root/test/ASTMerge
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-10 17:47:19 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-10 17:47:19 +0000
commit82fc4bfa6f8ea35488b9038dd83d40766c3645cf (patch)
tree3d356defac7b77e6900d0c40dfe9d3ff8b5f339f /test/ASTMerge
parent0f962a8e61e1c094a89df17f9d3ad947d31c4e5c (diff)
Implement AST importing and merging for typedefs. As part of this, provide a lame implementation for importing TypeSourceInfos.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ASTMerge')
-rw-r--r--test/ASTMerge/Inputs/typedef1.c4
-rw-r--r--test/ASTMerge/Inputs/typedef2.c4
-rw-r--r--test/ASTMerge/typedef.c7
-rw-r--r--test/ASTMerge/var.c1
4 files changed, 16 insertions, 0 deletions
diff --git a/test/ASTMerge/Inputs/typedef1.c b/test/ASTMerge/Inputs/typedef1.c
new file mode 100644
index 0000000000..5657675685
--- /dev/null
+++ b/test/ASTMerge/Inputs/typedef1.c
@@ -0,0 +1,4 @@
+typedef int Typedef1;
+typedef int Typedef2;
+Typedef1 x1;
+Typedef2 x2;
diff --git a/test/ASTMerge/Inputs/typedef2.c b/test/ASTMerge/Inputs/typedef2.c
new file mode 100644
index 0000000000..129d7101e9
--- /dev/null
+++ b/test/ASTMerge/Inputs/typedef2.c
@@ -0,0 +1,4 @@
+typedef int Typedef1;
+typedef double Typedef2;
+Typedef1 x1;
+Typedef2 x2;
diff --git a/test/ASTMerge/typedef.c b/test/ASTMerge/typedef.c
new file mode 100644
index 0000000000..4498864b49
--- /dev/null
+++ b/test/ASTMerge/typedef.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/typedef1.c
+// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/typedef2.c
+// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
+
+// CHECK: typedef2.c:4:10: error: external variable 'x2' declared with incompatible types in different translation units ('Typedef2' (aka 'double') vs. 'Typedef2' (aka 'int'))
+// CHECK: typedef1.c:4:10: note: declared here with type 'Typedef2' (aka 'int')
+// CHECK: 2 diagnostics
diff --git a/test/ASTMerge/var.c b/test/ASTMerge/var.c
index 06bebd5ee8..fd307940af 100644
--- a/test/ASTMerge/var.c
+++ b/test/ASTMerge/var.c
@@ -9,3 +9,4 @@
// CHECK: var1.h:1:8: note: declared here with type 'double'
// CHECK: error: external variable 'xarray3' declared with incompatible types in different translation units ('int [17]' vs. 'int [18]')
// CHECK: var1.c:7:5: note: declared here with type 'int [18]'
+// CHECK: 6 diagnostics