blob: c0b279f88a381f3cc36c955b1153a4adb561fc0b [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
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00006// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s -DWITH_PCH
7
8#ifdef WITH_PCH
9// expected-no-diagnostics
10#endif
Douglas Gregor0b748912009-04-14 21:18:50 +000011
Douglas Gregor8ecdb652010-04-28 22:16:22 +000012__SIZE_TYPE__ size_type_value;
Douglas Gregor0b748912009-04-14 21:18:50 +000013int integer;
14long long_integer;
Douglas Gregor17fc2232009-04-14 21:55:33 +000015double floating;
Douglas Gregorcb2ca732009-04-15 22:19:53 +000016_Complex double floating_complex;
Douglas Gregor0b748912009-04-14 21:18:50 +000017
18// DeclRefExpr
19int_decl_ref *int_ptr1 = &integer;
20enum_decl_ref *enum_ptr1 = &integer;
Douglas Gregor17fc2232009-04-14 21:55:33 +000021
22// IntegerLiteral
Douglas Gregor0b748912009-04-14 21:18:50 +000023integer_literal *int_ptr2 = &integer;
24long_literal *long_ptr1 = &long_integer;
25
Douglas Gregordb600c32009-04-15 00:25:59 +000026// FloatingLiteral + ParenExpr
Douglas Gregor17fc2232009-04-14 21:55:33 +000027floating_literal *double_ptr = &floating;
28
Douglas Gregorcb2ca732009-04-15 22:19:53 +000029// ImaginaryLiteral
30imaginary_literal *cdouble_ptr = &floating_complex;
31
Douglas Gregor673ecd62009-04-15 16:35:07 +000032// StringLiteral
33const char* printHello() {
34 return hello;
35}
36
Douglas Gregor17fc2232009-04-14 21:55:33 +000037// CharacterLiteral
Douglas Gregor0b748912009-04-14 21:18:50 +000038char_literal *int_ptr3 = &integer;
Douglas Gregordb600c32009-04-15 00:25:59 +000039
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000040// UnaryOperator
41negate_enum *int_ptr4 = &integer;
42
Douglas Gregor8ecdb652010-04-28 22:16:22 +000043// OffsetOfExpr
44offsetof_type *offsetof_ptr = &size_type_value;
45
Peter Collingbournef4e3cfb2011-03-11 19:24:49 +000046// UnaryExprOrTypeTraitExpr
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000047typeof(sizeof(float)) size_t_value;
48typeof_sizeof *size_t_ptr = &size_t_value;
49typeof_sizeof2 *size_t_ptr2 = &size_t_value;
50
Douglas Gregorcb2ca732009-04-15 22:19:53 +000051// ArraySubscriptExpr
52array_subscript *double_ptr1_5 = &floating;
53
Douglas Gregor1f0d0132009-04-15 17:43:59 +000054// CallExpr
55call_returning_double *double_ptr2 = &floating;
56
57// MemberExpr
58member_ref_double *double_ptr3 = &floating;
59
Douglas Gregordb600c32009-04-15 00:25:59 +000060// BinaryOperator
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000061add_result *int_ptr5 = &integer;
Douglas Gregordb600c32009-04-15 00:25:59 +000062
Douglas Gregorad90e962009-04-15 22:40:36 +000063// CompoundAssignOperator
64addeq_result *int_ptr6 = &integer;
65
Argyrios Kyrtzidis919e6932010-06-28 22:28:35 +000066add_result_with_typeinfo *int_typeinfo_ptr6;
67
Douglas Gregorad90e962009-04-15 22:40:36 +000068// ConditionalOperator
69conditional_operator *double_ptr4 = &floating;
70
Douglas Gregordb600c32009-04-15 00:25:59 +000071// CStyleCastExpr
72void_ptr vp1 = &integer;
Douglas Gregord3c98a02009-04-15 23:02:49 +000073
Douglas Gregorba6d7e72009-04-16 02:33:48 +000074// CompoundLiteral
75struct S s;
76compound_literal *sptr = &s;
77
Douglas Gregord3c98a02009-04-15 23:02:49 +000078// ExtVectorElementExpr
79ext_vector_element *double_ptr5 = &floating;
Douglas Gregor44cae0c2009-04-15 23:33:31 +000080
Douglas Gregord077d752009-04-16 00:55:48 +000081// InitListExpr
82double get_from_double_array(unsigned Idx) { return double_array[Idx]; }
83
84/// DesignatedInitExpr
85float get_from_designated(unsigned Idx) {
86 return designated_inits[2].y;
87}
88
Douglas Gregor44cae0c2009-04-15 23:33:31 +000089// TypesCompatibleExpr
90types_compatible *int_ptr7 = &integer;
91
92// ChooseExpr
93choose_expr *int_ptr8 = &integer;
94
95// GNUNullExpr FIXME: needs C++
96//null_type null = __null;
Douglas Gregor94cd5d12009-04-16 00:01:45 +000097
98// ShuffleVectorExpr
99shuffle_expr *vec_ptr = &vec2;
Peter Collingbournef111d932011-04-15 00:35:48 +0000100
101// GenericSelectionExpr
102generic_selection_expr *double_ptr6 = &floating;