blob: 038a18ba5b26bb3ede03350794351d30d20ce103 [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
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000042// SizeOfAlignOfExpr
43typeof(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
62// ConditionalOperator
63conditional_operator *double_ptr4 = &floating;
64
Douglas Gregordb600c32009-04-15 00:25:59 +000065// CStyleCastExpr
66void_ptr vp1 = &integer;
Douglas Gregord3c98a02009-04-15 23:02:49 +000067
Douglas Gregorba6d7e72009-04-16 02:33:48 +000068// CompoundLiteral
69struct S s;
70compound_literal *sptr = &s;
71
Douglas Gregord3c98a02009-04-15 23:02:49 +000072// ExtVectorElementExpr
73ext_vector_element *double_ptr5 = &floating;
Douglas Gregor44cae0c2009-04-15 23:33:31 +000074
Douglas Gregord077d752009-04-16 00:55:48 +000075// InitListExpr
76double get_from_double_array(unsigned Idx) { return double_array[Idx]; }
77
78/// DesignatedInitExpr
79float get_from_designated(unsigned Idx) {
80 return designated_inits[2].y;
81}
82
Douglas Gregor44cae0c2009-04-15 23:33:31 +000083// TypesCompatibleExpr
84types_compatible *int_ptr7 = &integer;
85
86// ChooseExpr
87choose_expr *int_ptr8 = &integer;
88
89// GNUNullExpr FIXME: needs C++
90//null_type null = __null;
Douglas Gregor94cd5d12009-04-16 00:01:45 +000091
92// ShuffleVectorExpr
93shuffle_expr *vec_ptr = &vec2;