diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-11 19:21:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-11 19:21:55 +0000 |
commit | 4800d95d28b20eca5d57c108ae3d2e6e312c1182 (patch) | |
tree | f1a333befd9c723568ab72c378d5486a4848651c /test/ASTMerge/Inputs/struct2.c | |
parent | d42ba8a578e905724633ac8fa1bf09cdfc3884c5 (diff) |
When AST merging for record declarations fails, warn about the
incompatibility and show where the structural differences are. For
example:
struct1.c:36:8: warning: type 'struct S7' has incompatible definitions
in different translation units
struct S7 { int i : 8; unsigned j : 8; } x7;
^
struct1.c:36:33: note: bit-field 'j' with type 'unsigned int' and length 8 here
struct S7 { int i : 8; unsigned j : 8; } x7;
^
struct2.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 16 here
struct S7 { int i : 8; unsigned j : 16; } x7;
^
There are a few changes to make this work:
- ASTImporter now has only a single Diagnostic object, not multiple
diagnostic objects. Otherwise, having a warning/error printed via
one Diagnostic and its note printed on the other Diagnostic could
cause the note to be suppressed.
- Implemented import functionality for IntegerLiteral (along with
general support for statements and expressions)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ASTMerge/Inputs/struct2.c')
-rw-r--r-- | test/ASTMerge/Inputs/struct2.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ASTMerge/Inputs/struct2.c b/test/ASTMerge/Inputs/struct2.c index 0a90609006..a707ed2a5b 100644 --- a/test/ASTMerge/Inputs/struct2.c +++ b/test/ASTMerge/Inputs/struct2.c @@ -1,3 +1,4 @@ +// Matches struct S0 { int field1; float field2; @@ -5,9 +6,28 @@ struct S0 { 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; |