blob: 2b588a229e765fd99c48812b1a8b9ec6c0770ce7 [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
8int integer;
9long long_integer;
Douglas Gregor17fc2232009-04-14 21:55:33 +000010double floating;
Douglas Gregorcb2ca732009-04-15 22:19:53 +000011_Complex double floating_complex;
Douglas Gregor0b748912009-04-14 21:18:50 +000012
13// DeclRefExpr
14int_decl_ref *int_ptr1 = &integer;
15enum_decl_ref *enum_ptr1 = &integer;
Douglas Gregor17fc2232009-04-14 21:55:33 +000016
17// IntegerLiteral
Douglas Gregor0b748912009-04-14 21:18:50 +000018integer_literal *int_ptr2 = &integer;
19long_literal *long_ptr1 = &long_integer;
20
Douglas Gregordb600c32009-04-15 00:25:59 +000021// FloatingLiteral + ParenExpr
Douglas Gregor17fc2232009-04-14 21:55:33 +000022floating_literal *double_ptr = &floating;
23
Douglas Gregorcb2ca732009-04-15 22:19:53 +000024// ImaginaryLiteral
25imaginary_literal *cdouble_ptr = &floating_complex;
26
Douglas Gregor673ecd62009-04-15 16:35:07 +000027// StringLiteral
28const char* printHello() {
29 return hello;
30}
31
Douglas Gregor17fc2232009-04-14 21:55:33 +000032// CharacterLiteral
Douglas Gregor0b748912009-04-14 21:18:50 +000033char_literal *int_ptr3 = &integer;
Douglas Gregordb600c32009-04-15 00:25:59 +000034
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000035// UnaryOperator
36negate_enum *int_ptr4 = &integer;
37
38// SizeOfAlignOfExpr
39typeof(sizeof(float)) size_t_value;
40typeof_sizeof *size_t_ptr = &size_t_value;
41typeof_sizeof2 *size_t_ptr2 = &size_t_value;
42
Douglas Gregorcb2ca732009-04-15 22:19:53 +000043// ArraySubscriptExpr
44array_subscript *double_ptr1_5 = &floating;
45
Douglas Gregor1f0d0132009-04-15 17:43:59 +000046// CallExpr
47call_returning_double *double_ptr2 = &floating;
48
49// MemberExpr
50member_ref_double *double_ptr3 = &floating;
51
Douglas Gregordb600c32009-04-15 00:25:59 +000052// BinaryOperator
Douglas Gregor0b0b77f2009-04-15 15:58:59 +000053add_result *int_ptr5 = &integer;
Douglas Gregordb600c32009-04-15 00:25:59 +000054
Douglas Gregorad90e962009-04-15 22:40:36 +000055// CompoundAssignOperator
56addeq_result *int_ptr6 = &integer;
57
58// ConditionalOperator
59conditional_operator *double_ptr4 = &floating;
60
Douglas Gregordb600c32009-04-15 00:25:59 +000061// CStyleCastExpr
62void_ptr vp1 = &integer;
Douglas Gregord3c98a02009-04-15 23:02:49 +000063
Douglas Gregorba6d7e72009-04-16 02:33:48 +000064// CompoundLiteral
65struct S s;
66compound_literal *sptr = &s;
67
Douglas Gregord3c98a02009-04-15 23:02:49 +000068// ExtVectorElementExpr
69ext_vector_element *double_ptr5 = &floating;
Douglas Gregor44cae0c2009-04-15 23:33:31 +000070
Douglas Gregord077d752009-04-16 00:55:48 +000071// InitListExpr
72double get_from_double_array(unsigned Idx) { return double_array[Idx]; }
73
74/// DesignatedInitExpr
75float get_from_designated(unsigned Idx) {
76 return designated_inits[2].y;
77}
78
Douglas Gregor44cae0c2009-04-15 23:33:31 +000079// TypesCompatibleExpr
80types_compatible *int_ptr7 = &integer;
81
82// ChooseExpr
83choose_expr *int_ptr8 = &integer;
84
85// GNUNullExpr FIXME: needs C++
86//null_type null = __null;
Douglas Gregor94cd5d12009-04-16 00:01:45 +000087
88// ShuffleVectorExpr
89shuffle_expr *vec_ptr = &vec2;