diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-13 21:20:57 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-13 21:20:57 +0000 |
commit | 183671e2d260930a8c43abc177f80f68cab041c0 (patch) | |
tree | 1e7ba3d7fad59387ee4d8072d8131c554a04e7e0 /clang/test | |
parent | 4184ac847f91dc7a8644ad6c5a3e389923117eb3 (diff) | |
download | bcm5719-llvm-183671e2d260930a8c43abc177f80f68cab041c0.tar.gz bcm5719-llvm-183671e2d260930a8c43abc177f80f68cab041c0.zip |
PCH support for record decls/types and their fields. Now that we can
handle the definition of __builtin_va_list on x86-64, eliminate the
forced -triple in PCH tests to get better coverage.
llvm-svn: 68988
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/PCH/enum.c | 6 | ||||
-rw-r--r-- | clang/test/PCH/line-directive.c | 6 | ||||
-rw-r--r-- | clang/test/PCH/struct.c | 24 | ||||
-rw-r--r-- | clang/test/PCH/struct.h | 25 | ||||
-rw-r--r-- | clang/test/PCH/types.c | 6 | ||||
-rw-r--r-- | clang/test/PCH/variables.c | 6 |
6 files changed, 61 insertions, 12 deletions
diff --git a/clang/test/PCH/enum.c b/clang/test/PCH/enum.c index 92869b6bc83..f3e8a09d93e 100644 --- a/clang/test/PCH/enum.c +++ b/clang/test/PCH/enum.c @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -triple=i686-apple-darwin9 -include %S/enum.h -fsyntax-only -verify %s +// RUN: clang-cc -include %S/enum.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -emit-pch -triple=i686-apple-darwin9 -o %t %S/enum.h && -// RUN: clang-cc -triple=i686-apple-darwin9 -include-pch %t -fsyntax-only -verify %s +// RUN: clang-cc -emit-pch -o %t %S/enum.h && +// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s int i = Red; diff --git a/clang/test/PCH/line-directive.c b/clang/test/PCH/line-directive.c index 87aa4b0a528..ed54842aa74 100644 --- a/clang/test/PCH/line-directive.c +++ b/clang/test/PCH/line-directive.c @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -triple=i686-apple-darwin9 -include %S/line-directive.h -fsyntax-only %s 2>&1|grep "25:5" +// RUN: clang-cc -include %S/line-directive.h -fsyntax-only %s 2>&1|grep "25:5" // Test with pch. -// RUN: clang-cc -emit-pch -triple=i686-apple-darwin9 -o %t %S/line-directive.h && -// RUN: clang-cc -triple=i686-apple-darwin9 -include-pch %t -fsyntax-only %s 2>&1|grep "25:5" +// RUN: clang-cc -emit-pch -o %t %S/line-directive.h && +// RUN: clang-cc -include-pch %t -fsyntax-only %s 2>&1|grep "25:5" double x; // expected-error{{redefinition of 'x' with a different type}} diff --git a/clang/test/PCH/struct.c b/clang/test/PCH/struct.c new file mode 100644 index 00000000000..c81ec469c58 --- /dev/null +++ b/clang/test/PCH/struct.c @@ -0,0 +1,24 @@ +// Test this without pch. +// RUN: clang-cc -include %S/struct.h -fsyntax-only -verify %s + +// Test with pch. +// RUN: clang-cc -emit-pch -o %t %S/struct.h && +// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s + +struct Point *p1; + +float getX(struct Point *p1) { + return p1->x; +} + +void *get_fun_ptr() { + return fun->is_ptr? fun->ptr : 0; +} + +struct Fun2 { + int very_fun; +}; + +int get_very_fun() { + return fun2->very_fun; +} diff --git a/clang/test/PCH/struct.h b/clang/test/PCH/struct.h new file mode 100644 index 00000000000..e3d85abaaeb --- /dev/null +++ b/clang/test/PCH/struct.h @@ -0,0 +1,25 @@ +// Used with the struct.c test + +struct Point { + float x, y, z; +}; + +struct Point2 { + float xValue, yValue, zValue; +}; + +struct Fun; + +struct Fun *fun; + +struct Fun { + int is_ptr; + + union { + void *ptr; + int *integer; + }; +}; + +struct Fun2; +struct Fun2 *fun2; diff --git a/clang/test/PCH/types.c b/clang/test/PCH/types.c index 764efe77305..e62a4bbe3bf 100644 --- a/clang/test/PCH/types.c +++ b/clang/test/PCH/types.c @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -triple=i686-apple-darwin9 -fblocks -include %S/types.h -fsyntax-only -verify %s +// RUN: clang-cc -fblocks -include %S/types.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -emit-pch -triple=i686-apple-darwin9 -fblocks -o %t %S/types.h && -// RUN: clang-cc -triple=i686-apple-darwin9 -fblocks -include-pch %t -fsyntax-only -verify %s +// RUN: clang-cc -emit-pch -fblocks -o %t %S/types.h && +// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s // FIXME: TYPE_EXT_QUAL // FIXME: TYPE_FIXED_WIDTH_INT diff --git a/clang/test/PCH/variables.c b/clang/test/PCH/variables.c index ec1657617ea..4f42e504816 100644 --- a/clang/test/PCH/variables.c +++ b/clang/test/PCH/variables.c @@ -1,9 +1,9 @@ // Test this without pch. -// RUN: clang-cc -triple=i686-apple-darwin9 -include %S/variables.h -fsyntax-only -verify %s +// RUN: clang-cc -include %S/variables.h -fsyntax-only -verify %s // Test with pch. -// RUN: clang-cc -emit-pch -triple=i686-apple-darwin9 -o %t %S/variables.h && -// RUN: clang-cc -triple=i686-apple-darwin9 -include-pch %t -fsyntax-only -verify %s +// RUN: clang-cc -emit-pch -o %t %S/variables.h && +// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s int *ip2 = &x; float *fp = &ip; // expected-warning{{incompatible pointer types}} |