From: Douglas Gregor Date: Thu, 11 Feb 2010 18:18:11 +0000 (+0000) Subject: Add missing test cases for AST merging of structures. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b203c9ee39be3170a7d545db057de8ea62959259;p=clang Add missing test cases for AST merging of structures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95886 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/ASTMerge/Inputs/struct1.c b/test/ASTMerge/Inputs/struct1.c new file mode 100644 index 0000000000..381f00a0a6 --- /dev/null +++ b/test/ASTMerge/Inputs/struct1.c @@ -0,0 +1,16 @@ +typedef int Int; +typedef float Float; + +struct S0 { + Int field1; + Float field2; +}; + +struct S0 x0; + +struct S1 { + Int field1; + int field2; +}; + +struct S1 x1; diff --git a/test/ASTMerge/Inputs/struct2.c b/test/ASTMerge/Inputs/struct2.c new file mode 100644 index 0000000000..0a90609006 --- /dev/null +++ b/test/ASTMerge/Inputs/struct2.c @@ -0,0 +1,13 @@ +struct S0 { + int field1; + float field2; +}; + +struct S0 x0; + +struct S1 { + int field1; + float field2; +}; + +struct S1 x1; diff --git a/test/ASTMerge/struct.c b/test/ASTMerge/struct.c new file mode 100644 index 0000000000..99fa74b10d --- /dev/null +++ b/test/ASTMerge/struct.c @@ -0,0 +1,7 @@ +// 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: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s + +// CHECK: struct2.c:13:11: error: external variable 'x1' declared with incompatible types in different translation units ('struct S1' vs. 'struct S1') +// CHECK: struct1.c:16:11: note: declared here with type 'struct S1' +// CHECK: 2 diagnostics