exprs.c revision 4fcfde4d5c8f25e40720972a5543d538a0dcb220
1// Test this without pch.
2// RUN: clang-cc -fblocks -include %S/exprs.h -fsyntax-only -verify %s
3
4// Test with pch.
5// RUN: clang-cc -emit-pch -fblocks -o %t %S/exprs.h
6// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s
7
8int integer;
9long long_integer;
10double floating;
11_Complex double floating_complex;
12
13// DeclRefExpr
14int_decl_ref *int_ptr1 = &integer;
15enum_decl_ref *enum_ptr1 = &integer;
16
17// IntegerLiteral
18integer_literal *int_ptr2 = &integer;
19long_literal *long_ptr1 = &long_integer;
20
21// FloatingLiteral + ParenExpr
22floating_literal *double_ptr = &floating;
23
24// ImaginaryLiteral
25imaginary_literal *cdouble_ptr = &floating_complex;
26
27// StringLiteral
28const char* printHello() {
29  return hello;
30}
31
32// CharacterLiteral
33char_literal *int_ptr3 = &integer;
34
35// 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
43// ArraySubscriptExpr
44array_subscript *double_ptr1_5 = &floating;
45
46// CallExpr
47call_returning_double *double_ptr2 = &floating;
48
49// MemberExpr
50member_ref_double *double_ptr3 = &floating;
51
52// BinaryOperator
53add_result *int_ptr5 = &integer;
54
55// CompoundAssignOperator
56addeq_result *int_ptr6 = &integer;
57
58// ConditionalOperator
59conditional_operator *double_ptr4 = &floating;
60
61// CStyleCastExpr
62void_ptr vp1 = &integer;
63
64// CompoundLiteral
65struct S s;
66compound_literal *sptr = &s;
67
68// ExtVectorElementExpr
69ext_vector_element *double_ptr5 = &floating;
70
71// 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
79// 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;
87
88// ShuffleVectorExpr
89shuffle_expr *vec_ptr = &vec2;
90