[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / exprs.c
blob1244b2faaf7f264420d91c787009acfccc386425
1 // Test this without pch.
2 // RUN: %clang_cc1 -fblocks -include %S/exprs.h -fsyntax-only -verify %s
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
8 #ifdef WITH_PCH
9 // expected-no-diagnostics
10 #endif
12 __SIZE_TYPE__ size_type_value;
13 int integer;
14 long long_integer;
15 double floating;
16 _Complex double floating_complex;
18 // DeclRefExpr
19 int_decl_ref *int_ptr1 = &integer;
20 enum_decl_ref *enum_ptr1 = &integer;
22 // IntegerLiteral
23 integer_literal *int_ptr2 = &integer;
24 long_literal *long_ptr1 = &long_integer;
26 // FloatingLiteral + ParenExpr
27 floating_literal *double_ptr = &floating;
29 // ImaginaryLiteral
30 imaginary_literal *cdouble_ptr = &floating_complex;
32 // StringLiteral
33 const char* printHello(void) {
34 return hello;
37 // CharacterLiteral
38 char_literal *int_ptr3 = &integer;
40 // UnaryOperator
41 negate_enum *int_ptr4 = &integer;
43 // OffsetOfExpr
44 offsetof_type *offsetof_ptr = &size_type_value;
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;
51 // ArraySubscriptExpr
52 array_subscript *double_ptr1_5 = &floating;
54 // CallExpr
55 call_returning_double *double_ptr2 = &floating;
57 // MemberExpr
58 member_ref_double *double_ptr3 = &floating;
60 // BinaryOperator
61 add_result *int_ptr5 = &integer;
63 // CompoundAssignOperator
64 addeq_result *int_ptr6 = &integer;
66 add_result_with_typeinfo *int_typeinfo_ptr6;
68 // ConditionalOperator
69 conditional_operator *double_ptr4 = &floating;
71 // CStyleCastExpr
72 void_ptr vp1 = &integer;
74 // CompoundLiteral
75 struct S s;
76 compound_literal *sptr = &s;
78 // ExtVectorElementExpr
79 ext_vector_element *double_ptr5 = &floating;
81 // InitListExpr
82 double get_from_double_array(unsigned Idx) { return double_array[Idx]; }
84 /// DesignatedInitExpr
85 float get_from_designated(unsigned Idx) {
86 return designated_inits[2].y;
89 // TypesCompatibleExpr
90 types_compatible *int_ptr7 = &integer;
92 // ChooseExpr
93 choose_expr *int_ptr8 = &integer;
95 // GNUNullExpr FIXME: needs C++
96 //null_type null = __null;
98 // ShuffleVectorExpr
99 shuffle_expr *vec_ptr = &vec2;
101 // GenericSelectionExpr
102 generic_selection_expr *double_ptr6 = &floating;