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