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