diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-10 00:15:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-10 00:15:17 +0000 |
commit | 885237354fd902998c6ae9d7cc3dc8de96b123dc (patch) | |
tree | 993dd13118715465d05a26c1ca414597eee4da60 /test/ASTMerge | |
parent | b24b0f8cc55d34a050ce1a4722a654d56e9fd947 (diff) |
Implement basic support for importing source locations from one AST
into another AST, including their include history. Here's an example
error that involves a conflict merging a variable with different types
in two translation units (diagnosed in the third AST context into
which everything is merged).
/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var2.c:3:5:
error: external variable 'x2' declared with incompatible types in
different translation units ('int' vs. 'double')
int x2;
^
In file included from
/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.c:3:
/Volumes/Data/dgregor/Projects/llvm/tools/clang/test/ASTMerge/Inputs/var1.h:1:8:
note: declared here with type 'double'
double x2;
^
Although we maintain include history, we do not maintain macro
instantiation history across a merge. Instead, we map down to the
spelling location (for now!).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ASTMerge')
-rw-r--r-- | test/ASTMerge/Inputs/var1.c | 1 | ||||
-rw-r--r-- | test/ASTMerge/Inputs/var2.c | 1 | ||||
-rw-r--r-- | test/ASTMerge/var.c | 6 |
3 files changed, 7 insertions, 1 deletions
diff --git a/test/ASTMerge/Inputs/var1.c b/test/ASTMerge/Inputs/var1.c index c87e58b6ad..465258988b 100644 --- a/test/ASTMerge/Inputs/var1.c +++ b/test/ASTMerge/Inputs/var1.c @@ -1,2 +1,3 @@ int *x0; float **x1; +#include "var1.h" diff --git a/test/ASTMerge/Inputs/var2.c b/test/ASTMerge/Inputs/var2.c index 526a45b9f7..e93a010cbf 100644 --- a/test/ASTMerge/Inputs/var2.c +++ b/test/ASTMerge/Inputs/var2.c @@ -1,2 +1,3 @@ int *x0; double *x1; +int x2; diff --git a/test/ASTMerge/var.c b/test/ASTMerge/var.c index 4fda4acb9d..98ad7ab4a0 100644 --- a/test/ASTMerge/var.c +++ b/test/ASTMerge/var.c @@ -2,4 +2,8 @@ // RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/var2.c // RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s -// CHECK: error: external variable 'x1' declared with incompatible types in different translation units ('double *' vs. 'float **') +// CHECK: var2.c:2:9: error: external variable 'x1' declared with incompatible types in different translation units ('double *' vs. 'float **') +// CHECK: var1.c:2:9: note: declared here with type 'float **' +// CHECK: var2.c:3:5: error: external variable 'x2' declared with incompatible types in different translation units ('int' vs. 'double') +// CHECK: In file included from{{.*}}var1.c:3: +// CHECK: var1.h:1:8: note: declared here with type 'double' |