diff options
Diffstat (limited to 'clang/test/PCH')
-rw-r--r-- | clang/test/PCH/enum.h | 4 | ||||
-rw-r--r-- | clang/test/PCH/exprs.c | 19 | ||||
-rw-r--r-- | clang/test/PCH/exprs.h | 14 | ||||
-rw-r--r-- | clang/test/PCH/external-defs.c | 3 | ||||
-rw-r--r-- | clang/test/PCH/external-defs.h | 2 | ||||
-rw-r--r-- | clang/test/PCH/struct.c | 2 | ||||
-rw-r--r-- | clang/test/PCH/struct.h | 2 | ||||
-rw-r--r-- | clang/test/PCH/types.c | 5 | ||||
-rw-r--r-- | clang/test/PCH/types.h | 3 | ||||
-rw-r--r-- | clang/test/PCH/variables.c | 3 | ||||
-rw-r--r-- | clang/test/PCH/variables.h | 2 |
11 files changed, 49 insertions, 10 deletions
diff --git a/clang/test/PCH/enum.h b/clang/test/PCH/enum.h index cfa8d6f3d85..c94e314eb06 100644 --- a/clang/test/PCH/enum.h +++ b/clang/test/PCH/enum.h @@ -8,9 +8,9 @@ enum Color { enum Shape { Square, - Triangle, + Triangle = 17, Rhombus, Circle }; -enum Shape aRoundShape = Circle; +enum Shape aRoundShape;// FIXME: = Circle; diff --git a/clang/test/PCH/exprs.c b/clang/test/PCH/exprs.c new file mode 100644 index 00000000000..d1cd5636b89 --- /dev/null +++ b/clang/test/PCH/exprs.c @@ -0,0 +1,19 @@ +// Test this without pch. +// RUN: clang-cc -fblocks -include %S/exprs.h -fsyntax-only -verify %s + +// Test with pch. +// RUN: clang-cc -emit-pch -fblocks -o %t %S/exprs.h && +// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s + +int integer; +long long_integer; + +// DeclRefExpr +int_decl_ref *int_ptr1 = &integer; +enum_decl_ref *enum_ptr1 = &integer; +// IntegerLiteralExpr +integer_literal *int_ptr2 = &integer; +long_literal *long_ptr1 = &long_integer; + +// CharacterLiteralExpr +char_literal *int_ptr3 = &integer; diff --git a/clang/test/PCH/exprs.h b/clang/test/PCH/exprs.h new file mode 100644 index 00000000000..db6513c35bd --- /dev/null +++ b/clang/test/PCH/exprs.h @@ -0,0 +1,14 @@ +// Header for PCH test exprs.c + +// DeclRefExpr +int i = 17; +enum Enum { Enumerator = 18 }; +typedef typeof(i) int_decl_ref; +typedef typeof(Enumerator) enum_decl_ref; + +// IntegerLiteralExpr +typedef typeof(17) integer_literal; +typedef typeof(17l) long_literal; + +// CharacterLiteralExpr +typedef typeof('a') char_literal; diff --git a/clang/test/PCH/external-defs.c b/clang/test/PCH/external-defs.c index fd14c4fa8b3..5af21af517a 100644 --- a/clang/test/PCH/external-defs.c +++ b/clang/test/PCH/external-defs.c @@ -3,8 +3,7 @@ // RUN: clang-cc -triple x86_64-apple-darwin9 -include-pch %t.pch -emit-llvm -o %t %s && // RUN: grep "@x = common global i32 0" %t | count 1 && -// FIXME below: should be i32 17, but we don't serialize y's value yet -// RUN: grep "@y = common global i32 0" %t | count 1 && +// RUN: grep "@y = global i32 17" %t | count 1 && // RUN: grep "@z" %t | count 0 && // RUN: grep "@x2 = global i32 19" %t | count 1 && diff --git a/clang/test/PCH/external-defs.h b/clang/test/PCH/external-defs.h index 4ac9077d121..06c4601ccb3 100644 --- a/clang/test/PCH/external-defs.h +++ b/clang/test/PCH/external-defs.h @@ -4,7 +4,7 @@ int x; int x2; -// FIXME: check this, once we actually serialize it +// Definitions int y = 17; // Should not show up diff --git a/clang/test/PCH/struct.c b/clang/test/PCH/struct.c index 220f0794656..5ea9fe27570 100644 --- a/clang/test/PCH/struct.c +++ b/clang/test/PCH/struct.c @@ -23,6 +23,8 @@ int get_very_fun() { return fun2->very_fun; } +int *int_ptr_fail = &fun->is_ptr; // expected-error{{address of bit-field requested}} + /* FIXME: DeclContexts aren't yet able to find "struct Nested" nested within "struct S", so causing the following to fail. When not using PCH, this works because Sema puts the nested struct onto the diff --git a/clang/test/PCH/struct.h b/clang/test/PCH/struct.h index 6c256221fa0..2ffdd4aea58 100644 --- a/clang/test/PCH/struct.h +++ b/clang/test/PCH/struct.h @@ -13,7 +13,7 @@ struct Fun; struct Fun *fun; struct Fun { - int is_ptr; + int is_ptr : 1; union { void *ptr; diff --git a/clang/test/PCH/types.c b/clang/test/PCH/types.c index e62a4bbe3bf..425305c5842 100644 --- a/clang/test/PCH/types.c +++ b/clang/test/PCH/types.c @@ -56,7 +56,10 @@ proto *p2 = p1; // TYPE_TYPEDEF int_ptr_ptr ipp = &int_value_ptr; -// FIXME: TYPE_TYPEOF_EXPR +// TYPE_TYPEOF_EXPR +typeof_17 *t17 = &int_value; +struct S { int x, y; }; +typeof_17 t17_2 = (struct S){1, 2}; // expected-error{{incompatible type initializing}} // TYPE_TYPEOF int_ptr_ptr2 ipp2 = &int_value_ptr; diff --git a/clang/test/PCH/types.h b/clang/test/PCH/types.h index 3713e0b6900..54ab2152d7e 100644 --- a/clang/test/PCH/types.h +++ b/clang/test/PCH/types.h @@ -35,7 +35,8 @@ typedef float proto(float, float, ...); // TYPE_TYPEDEF typedef int_ptr * int_ptr_ptr; -// FIXME: TYPE_TYPEOF_EXPR +// TYPE_TYPEOF_EXPR +typedef typeof(17) typeof_17; // TYPE_TYPEOF typedef typeof(int_ptr *) int_ptr_ptr2; diff --git a/clang/test/PCH/variables.c b/clang/test/PCH/variables.c index 4f42e504816..afd45461d0c 100644 --- a/clang/test/PCH/variables.c +++ b/clang/test/PCH/variables.c @@ -9,7 +9,8 @@ int *ip2 = &x; float *fp = &ip; // expected-warning{{incompatible pointer types}} // FIXME:variables.h expected-note{{previous}} double z; // expected-error{{redefinition}} - +// FIXME:variables.h expected-note{{previous}} +int z2 = 18; // expected-error{{redefinition}} //double VeryHappy; // FIXME: xpected-error{{redefinition}} diff --git a/clang/test/PCH/variables.h b/clang/test/PCH/variables.h index 82e87aaf4bf..70aec651809 100644 --- a/clang/test/PCH/variables.h +++ b/clang/test/PCH/variables.h @@ -9,7 +9,7 @@ extern int *ip, x; float z; - +int z2 = 17; #define MAKE_HAPPY(X) X##Happy int MAKE_HAPPY(Very); |