blob: 5928abda58f3569fd6f9ca2dc2bdc4854e4a4124 [file] [log] [blame]
Douglas Gregor0b748912009-04-14 21:18:50 +00001// Test this without pch.
Daniel Dunbara5728872009-12-15 20:14:24 +00002// RUN: %clang_cc1 -fblocks -include %S/exprs.h -fsyntax-only -verify %s
Douglas Gregor0b748912009-04-14 21:18:50 +00003
4// Test with pch.
Daniel Dunbara5728872009-12-15 20:14:24 +00005// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/exprs.h
6// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s
Douglas Gregor0b748912009-04-14 21:18:50 +00007
Douglas Gregor8ecdb652010-04-28 22:16:22 +00008__SIZE_TYPE__ size_type_value;
Douglas Gregor0b748912009-04-14 21:18:50 +00009int integer;
10long long_integer;
Douglas Gregor17fc2232009-04-14 21:55:33 +000011double floating;
Douglas Gregorcb2ca732009-04-15 22:19:53 +000012_Complex double floating_complex;
Douglas Gregor0b748912009-04-14 21:18:50 +000013
14// DeclRefExpr
15int_decl_ref *int_ptr1 = &integer;
16enum_decl_ref *enum_ptr1 = &integer;
Douglas Gregor17fc2232009-04-14 21:55:33 +000017
18// IntegerLiteral
Douglas Gregor0b748912009-04-14 21:18:50 +000019integer_literal *int_ptr2 = &integer;
20long_literal *long_ptr1 = &long_integer;
21
Douglas Gregordb600c32009-04-15 00:25:59 +000022// FloatingLiteral + ParenExpr
Douglas Gregor17fc2232009-04-14 21:55:33 +000023floating_literal *double_ptr = &floating;
24
Douglas Gregorcb2ca732009-04-15 22:19:53 +000025// ImaginaryLiteral
26imaginary_literal *cdouble_ptr = &floating_complex;
27
Douglas Gregor673ecd62009-04-15 16:35:07 +000028// StringLiteral
29const char* printHello() {
30 return hello;
31}
32
Douglas Gregor17fc2232009-04-14 21:55:33 +000033// CharacterLiteral
Douglas Gregor0b748912009-04-14 21:18:50 +000034char_literal *int_ptr3 = &integer;
Douglas Gregordb600c32009-04-15 00:25:59 +000035
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000036// UnaryOperator
37negate_enum *int_ptr4 = &integer;
38
Douglas Gregor8ecdb652010-04-28 22:16:22 +000039// OffsetOfExpr
40offsetof_type *offsetof_ptr = &size_type_value;
41
Peter Collingbournef4e3cfb2011-03-11 19:24:49 +000042// UnaryExprOrTypeTraitExpr
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000043typeof(sizeof(float)) size_t_value;
44typeof_sizeof *size_t_ptr = &size_t_value;
45typeof_sizeof2 *size_t_ptr2 = &size_t_value;
46
Douglas Gregorcb2ca732009-04-15 22:19:53 +000047// ArraySubscriptExpr
48array_subscript *double_ptr1_5 = &floating;
49
Douglas Gregor1f0d0132009-04-15 17:43:59 +000050// CallExpr
51call_returning_double *double_ptr2 = &floating;
52
53// MemberExpr
54member_ref_double *double_ptr3 = &floating;
55
Douglas Gregordb600c32009-04-15 00:25:59 +000056// BinaryOperator
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000057add_result *int_ptr5 = &integer;
Douglas Gregordb600c32009-04-15 00:25:59 +000058
Douglas Gregorad90e962009-04-15 22:40:36 +000059// CompoundAssignOperator
60addeq_result *int_ptr6 = &integer;
61
Argyrios Kyrtzidis919e6932010-06-28 22:28:35 +000062add_result_with_typeinfo *int_typeinfo_ptr6;
63
Douglas Gregorad90e962009-04-15 22:40:36 +000064// ConditionalOperator
65conditional_operator *double_ptr4 = &floating;
66
Douglas Gregordb600c32009-04-15 00:25:59 +000067// CStyleCastExpr
68void_ptr vp1 = &integer;
Douglas Gregord3c98a02009-04-15 23:02:49 +000069
Douglas Gregorba6d7e72009-04-16 02:33:48 +000070// CompoundLiteral
71struct S s;
72compound_literal *sptr = &s;
73
Douglas Gregord3c98a02009-04-15 23:02:49 +000074// ExtVectorElementExpr
75ext_vector_element *double_ptr5 = &floating;
Douglas Gregor44cae0c2009-04-15 23:33:31 +000076
Douglas Gregord077d752009-04-16 00:55:48 +000077// InitListExpr
78double get_from_double_array(unsigned Idx) { return double_array[Idx]; }
79
80/// DesignatedInitExpr
81float get_from_designated(unsigned Idx) {
82 return designated_inits[2].y;
83}
84
Douglas Gregor44cae0c2009-04-15 23:33:31 +000085// TypesCompatibleExpr
86types_compatible *int_ptr7 = &integer;
87
88// ChooseExpr
89choose_expr *int_ptr8 = &integer;
90
91// GNUNullExpr FIXME: needs C++
92//null_type null = __null;
Douglas Gregor94cd5d12009-04-16 00:01:45 +000093
94// ShuffleVectorExpr
95shuffle_expr *vec_ptr = &vec2;
Peter Collingbournef111d932011-04-15 00:35:48 +000096
97// GenericSelectionExpr
98generic_selection_expr *double_ptr6 = &floating;