Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 1 | // Test this without pch. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fblocks -include %S/exprs.h -fsyntax-only -verify %s |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 3 | |
| 4 | // Test with pch. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 5 | // RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/exprs.h |
| 6 | // RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 7 | |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 8 | __SIZE_TYPE__ size_type_value; |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 9 | int integer; |
| 10 | long long_integer; |
Douglas Gregor | 17fc223 | 2009-04-14 21:55:33 +0000 | [diff] [blame] | 11 | double floating; |
Douglas Gregor | cb2ca73 | 2009-04-15 22:19:53 +0000 | [diff] [blame] | 12 | _Complex double floating_complex; |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 13 | |
| 14 | // DeclRefExpr |
| 15 | int_decl_ref *int_ptr1 = &integer; |
| 16 | enum_decl_ref *enum_ptr1 = &integer; |
Douglas Gregor | 17fc223 | 2009-04-14 21:55:33 +0000 | [diff] [blame] | 17 | |
| 18 | // IntegerLiteral |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 19 | integer_literal *int_ptr2 = &integer; |
| 20 | long_literal *long_ptr1 = &long_integer; |
| 21 | |
Douglas Gregor | db600c3 | 2009-04-15 00:25:59 +0000 | [diff] [blame] | 22 | // FloatingLiteral + ParenExpr |
Douglas Gregor | 17fc223 | 2009-04-14 21:55:33 +0000 | [diff] [blame] | 23 | floating_literal *double_ptr = &floating; |
| 24 | |
Douglas Gregor | cb2ca73 | 2009-04-15 22:19:53 +0000 | [diff] [blame] | 25 | // ImaginaryLiteral |
| 26 | imaginary_literal *cdouble_ptr = &floating_complex; |
| 27 | |
Douglas Gregor | 673ecd6 | 2009-04-15 16:35:07 +0000 | [diff] [blame] | 28 | // StringLiteral |
| 29 | const char* printHello() { |
| 30 | return hello; |
| 31 | } |
| 32 | |
Douglas Gregor | 17fc223 | 2009-04-14 21:55:33 +0000 | [diff] [blame] | 33 | // CharacterLiteral |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 34 | char_literal *int_ptr3 = &integer; |
Douglas Gregor | db600c3 | 2009-04-15 00:25:59 +0000 | [diff] [blame] | 35 | |
Douglas Gregor | 0b0b77f | 2009-04-15 15:58:59 +0000 | [diff] [blame] | 36 | // UnaryOperator |
| 37 | negate_enum *int_ptr4 = &integer; |
| 38 | |
Douglas Gregor | 8ecdb65 | 2010-04-28 22:16:22 +0000 | [diff] [blame] | 39 | // OffsetOfExpr |
| 40 | offsetof_type *offsetof_ptr = &size_type_value; |
| 41 | |
Peter Collingbourne | f4e3cfb | 2011-03-11 19:24:49 +0000 | [diff] [blame] | 42 | // UnaryExprOrTypeTraitExpr |
Douglas Gregor | 0b0b77f | 2009-04-15 15:58:59 +0000 | [diff] [blame] | 43 | typeof(sizeof(float)) size_t_value; |
| 44 | typeof_sizeof *size_t_ptr = &size_t_value; |
| 45 | typeof_sizeof2 *size_t_ptr2 = &size_t_value; |
| 46 | |
Douglas Gregor | cb2ca73 | 2009-04-15 22:19:53 +0000 | [diff] [blame] | 47 | // ArraySubscriptExpr |
| 48 | array_subscript *double_ptr1_5 = &floating; |
| 49 | |
Douglas Gregor | 1f0d013 | 2009-04-15 17:43:59 +0000 | [diff] [blame] | 50 | // CallExpr |
| 51 | call_returning_double *double_ptr2 = &floating; |
| 52 | |
| 53 | // MemberExpr |
| 54 | member_ref_double *double_ptr3 = &floating; |
| 55 | |
Douglas Gregor | db600c3 | 2009-04-15 00:25:59 +0000 | [diff] [blame] | 56 | // BinaryOperator |
Douglas Gregor | 0b0b77f | 2009-04-15 15:58:59 +0000 | [diff] [blame] | 57 | add_result *int_ptr5 = &integer; |
Douglas Gregor | db600c3 | 2009-04-15 00:25:59 +0000 | [diff] [blame] | 58 | |
Douglas Gregor | ad90e96 | 2009-04-15 22:40:36 +0000 | [diff] [blame] | 59 | // CompoundAssignOperator |
| 60 | addeq_result *int_ptr6 = &integer; |
| 61 | |
Argyrios Kyrtzidis | 919e693 | 2010-06-28 22:28:35 +0000 | [diff] [blame] | 62 | add_result_with_typeinfo *int_typeinfo_ptr6; |
| 63 | |
Douglas Gregor | ad90e96 | 2009-04-15 22:40:36 +0000 | [diff] [blame] | 64 | // ConditionalOperator |
| 65 | conditional_operator *double_ptr4 = &floating; |
| 66 | |
Douglas Gregor | db600c3 | 2009-04-15 00:25:59 +0000 | [diff] [blame] | 67 | // CStyleCastExpr |
| 68 | void_ptr vp1 = &integer; |
Douglas Gregor | d3c98a0 | 2009-04-15 23:02:49 +0000 | [diff] [blame] | 69 | |
Douglas Gregor | ba6d7e7 | 2009-04-16 02:33:48 +0000 | [diff] [blame] | 70 | // CompoundLiteral |
| 71 | struct S s; |
| 72 | compound_literal *sptr = &s; |
| 73 | |
Douglas Gregor | d3c98a0 | 2009-04-15 23:02:49 +0000 | [diff] [blame] | 74 | // ExtVectorElementExpr |
| 75 | ext_vector_element *double_ptr5 = &floating; |
Douglas Gregor | 44cae0c | 2009-04-15 23:33:31 +0000 | [diff] [blame] | 76 | |
Douglas Gregor | d077d75 | 2009-04-16 00:55:48 +0000 | [diff] [blame] | 77 | // InitListExpr |
| 78 | double get_from_double_array(unsigned Idx) { return double_array[Idx]; } |
| 79 | |
| 80 | /// DesignatedInitExpr |
| 81 | float get_from_designated(unsigned Idx) { |
| 82 | return designated_inits[2].y; |
| 83 | } |
| 84 | |
Douglas Gregor | 44cae0c | 2009-04-15 23:33:31 +0000 | [diff] [blame] | 85 | // TypesCompatibleExpr |
| 86 | types_compatible *int_ptr7 = &integer; |
| 87 | |
| 88 | // ChooseExpr |
| 89 | choose_expr *int_ptr8 = &integer; |
| 90 | |
| 91 | // GNUNullExpr FIXME: needs C++ |
| 92 | //null_type null = __null; |
Douglas Gregor | 94cd5d1 | 2009-04-16 00:01:45 +0000 | [diff] [blame] | 93 | |
| 94 | // ShuffleVectorExpr |
| 95 | shuffle_expr *vec_ptr = &vec2; |
Peter Collingbourne | f111d93 | 2011-04-15 00:35:48 +0000 | [diff] [blame] | 96 | |
| 97 | // GenericSelectionExpr |
| 98 | generic_selection_expr *double_ptr6 = &floating; |