xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/exprs.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test this without pch.
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fblocks -include %S/exprs.h -fsyntax-only -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // Test with pch.
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/exprs.h
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s -DWITH_PCH
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc #ifdef WITH_PCH
9*f4a2713aSLionel Sambuc // expected-no-diagnostics
10*f4a2713aSLionel Sambuc #endif
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc __SIZE_TYPE__ size_type_value;
13*f4a2713aSLionel Sambuc int integer;
14*f4a2713aSLionel Sambuc long long_integer;
15*f4a2713aSLionel Sambuc double floating;
16*f4a2713aSLionel Sambuc _Complex double floating_complex;
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc // DeclRefExpr
19*f4a2713aSLionel Sambuc int_decl_ref *int_ptr1 = &integer;
20*f4a2713aSLionel Sambuc enum_decl_ref *enum_ptr1 = &integer;
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc // IntegerLiteral
23*f4a2713aSLionel Sambuc integer_literal *int_ptr2 = &integer;
24*f4a2713aSLionel Sambuc long_literal *long_ptr1 = &long_integer;
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc // FloatingLiteral + ParenExpr
27*f4a2713aSLionel Sambuc floating_literal *double_ptr = &floating;
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc // ImaginaryLiteral
30*f4a2713aSLionel Sambuc imaginary_literal *cdouble_ptr = &floating_complex;
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc // StringLiteral
printHello()33*f4a2713aSLionel Sambuc const char* printHello() {
34*f4a2713aSLionel Sambuc   return hello;
35*f4a2713aSLionel Sambuc }
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc // CharacterLiteral
38*f4a2713aSLionel Sambuc char_literal *int_ptr3 = &integer;
39*f4a2713aSLionel Sambuc 
40*f4a2713aSLionel Sambuc // UnaryOperator
41*f4a2713aSLionel Sambuc negate_enum *int_ptr4 = &integer;
42*f4a2713aSLionel Sambuc 
43*f4a2713aSLionel Sambuc // OffsetOfExpr
44*f4a2713aSLionel Sambuc offsetof_type *offsetof_ptr = &size_type_value;
45*f4a2713aSLionel Sambuc 
46*f4a2713aSLionel Sambuc // UnaryExprOrTypeTraitExpr
47*f4a2713aSLionel Sambuc typeof(sizeof(float)) size_t_value;
48*f4a2713aSLionel Sambuc typeof_sizeof *size_t_ptr = &size_t_value;
49*f4a2713aSLionel Sambuc typeof_sizeof2 *size_t_ptr2 = &size_t_value;
50*f4a2713aSLionel Sambuc 
51*f4a2713aSLionel Sambuc // ArraySubscriptExpr
52*f4a2713aSLionel Sambuc array_subscript *double_ptr1_5 = &floating;
53*f4a2713aSLionel Sambuc 
54*f4a2713aSLionel Sambuc // CallExpr
55*f4a2713aSLionel Sambuc call_returning_double *double_ptr2 = &floating;
56*f4a2713aSLionel Sambuc 
57*f4a2713aSLionel Sambuc // MemberExpr
58*f4a2713aSLionel Sambuc member_ref_double *double_ptr3 = &floating;
59*f4a2713aSLionel Sambuc 
60*f4a2713aSLionel Sambuc // BinaryOperator
61*f4a2713aSLionel Sambuc add_result *int_ptr5 = &integer;
62*f4a2713aSLionel Sambuc 
63*f4a2713aSLionel Sambuc // CompoundAssignOperator
64*f4a2713aSLionel Sambuc addeq_result *int_ptr6 = &integer;
65*f4a2713aSLionel Sambuc 
66*f4a2713aSLionel Sambuc add_result_with_typeinfo *int_typeinfo_ptr6;
67*f4a2713aSLionel Sambuc 
68*f4a2713aSLionel Sambuc // ConditionalOperator
69*f4a2713aSLionel Sambuc conditional_operator *double_ptr4 = &floating;
70*f4a2713aSLionel Sambuc 
71*f4a2713aSLionel Sambuc // CStyleCastExpr
72*f4a2713aSLionel Sambuc void_ptr vp1 = &integer;
73*f4a2713aSLionel Sambuc 
74*f4a2713aSLionel Sambuc // CompoundLiteral
75*f4a2713aSLionel Sambuc struct S s;
76*f4a2713aSLionel Sambuc compound_literal *sptr = &s;
77*f4a2713aSLionel Sambuc 
78*f4a2713aSLionel Sambuc // ExtVectorElementExpr
79*f4a2713aSLionel Sambuc ext_vector_element *double_ptr5 = &floating;
80*f4a2713aSLionel Sambuc 
81*f4a2713aSLionel Sambuc // InitListExpr
get_from_double_array(unsigned Idx)82*f4a2713aSLionel Sambuc double get_from_double_array(unsigned Idx) { return double_array[Idx]; }
83*f4a2713aSLionel Sambuc 
84*f4a2713aSLionel Sambuc /// DesignatedInitExpr
get_from_designated(unsigned Idx)85*f4a2713aSLionel Sambuc float get_from_designated(unsigned Idx) {
86*f4a2713aSLionel Sambuc   return designated_inits[2].y;
87*f4a2713aSLionel Sambuc }
88*f4a2713aSLionel Sambuc 
89*f4a2713aSLionel Sambuc // TypesCompatibleExpr
90*f4a2713aSLionel Sambuc types_compatible *int_ptr7 = &integer;
91*f4a2713aSLionel Sambuc 
92*f4a2713aSLionel Sambuc // ChooseExpr
93*f4a2713aSLionel Sambuc choose_expr *int_ptr8 = &integer;
94*f4a2713aSLionel Sambuc 
95*f4a2713aSLionel Sambuc // GNUNullExpr FIXME: needs C++
96*f4a2713aSLionel Sambuc //null_type null = __null;
97*f4a2713aSLionel Sambuc 
98*f4a2713aSLionel Sambuc // ShuffleVectorExpr
99*f4a2713aSLionel Sambuc shuffle_expr *vec_ptr = &vec2;
100*f4a2713aSLionel Sambuc 
101*f4a2713aSLionel Sambuc // GenericSelectionExpr
102*f4a2713aSLionel Sambuc generic_selection_expr *double_ptr6 = &floating;
103