Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / PCH / exprs.h
blobd6735a727a538ddafde79ad2f34d03472f7db2ca
1 // Header for PCH test exprs.c
3 // DeclRefExpr
4 int i = 17;
5 enum Enum { Enumerator = 18 };
6 typedef typeof(i) int_decl_ref;
7 typedef typeof(Enumerator) enum_decl_ref;
9 // IntegerLiteral
10 typedef typeof(17) integer_literal;
11 typedef typeof(17l) long_literal;
13 // FloatingLiteral and ParenExpr
14 typedef typeof((42.5)) floating_literal;
16 // ImaginaryLiteral
17 typedef typeof(17.0i) imaginary_literal;
19 // StringLiteral
20 const char *hello = "Hello" "PCH" "World";
22 // CharacterLiteral
23 typedef typeof('a') char_literal;
25 // UnaryOperator
26 typedef typeof(-Enumerator) negate_enum;
28 // OffsetOfExpr
29 struct X {
30 int member;
32 struct Y {
33 struct X array[5];
35 struct Z {
36 struct Y y;
38 typedef typeof(__builtin_offsetof(struct Z, y.array[1 + 2].member))
39 offsetof_type;
41 // UnaryExprOrTypeTraitExpr
42 typedef typeof(sizeof(int)) typeof_sizeof;
43 typedef typeof(sizeof(Enumerator)) typeof_sizeof2;
45 // ArraySubscriptExpr
46 extern double values[];
47 typedef typeof(values[2]) array_subscript;
49 // CallExpr
50 double dplus(double x, double y);
51 double d0, d1;
52 typedef typeof((&dplus)(d0, d1)) call_returning_double;
54 // MemberExpr
55 struct S {
56 double x;
58 typedef typeof(((struct S*)0)->x) member_ref_double;
60 // BinaryOperator
61 typedef typeof(i + Enumerator) add_result;
63 // CompoundAssignOperator
64 typedef typeof(i += Enumerator) addeq_result;
66 // ConditionalOperator
67 typedef typeof(i? : d0) conditional_operator;
69 // CStyleCastExpr
70 typedef typeof((void *)0) void_ptr;
72 // CompoundLiteral
73 typedef typeof((struct S){.x = 3.5}) compound_literal;
75 typedef typeof(i + sizeof(int[i + Enumerator])) add_result_with_typeinfo;
77 // ExtVectorElementExpr
78 typedef __attribute__(( ext_vector_type(2) )) double double2;
79 extern double2 vec2, vec2b;
80 typedef typeof(vec2.x) ext_vector_element;
82 // InitListExpr
83 double double_array[3] = { 1.0, 2.0 };
85 // DesignatedInitExpr
86 struct {
87 int x;
88 float y;
89 } designated_inits[3] = { [0].y = 17,
90 [2].x = 12.3, // expected-warning {{implicit conversion from 'double' to 'int' changes value from 12.3 to 12}}
91 3.5 };
93 // TypesCompatibleExpr
94 typedef typeof(__builtin_types_compatible_p(float, double)) types_compatible;
96 // ChooseExpr
97 typedef typeof(__builtin_choose_expr(17 > 19, d0, 1)) choose_expr;
99 // GNUNullExpr FIXME: needs C++
100 // typedef typeof(__null) null_type;
102 // ShuffleVectorExpr
103 typedef typeof(__builtin_shufflevector(vec2, vec2b, 2, 1)) shuffle_expr;
105 // ConvertVectorExpr
106 typedef __attribute__(( ext_vector_type(2) )) float float2;
107 typedef typeof(__builtin_convertvector(vec2, float2)) convert_expr;
109 // GenericSelectionExpr
110 typedef typeof(_Generic(i, char*: 0, int: 0., default: hello))
111 generic_selection_expr;