summaryrefslogtreecommitdiffstats
path: root/test/PCH/exprs.h
blob: 7012422aad331792d89ed77aeeb7d8f55e4f0e34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Header for PCH test exprs.c

// DeclRefExpr
int i = 17;
enum Enum { Enumerator = 18 };
typedef typeof(i) int_decl_ref;
typedef typeof(Enumerator) enum_decl_ref;

// IntegerLiteral
typedef typeof(17) integer_literal;
typedef typeof(17l) long_literal;

// FloatingLiteral and ParenExpr
typedef typeof((42.5)) floating_literal;

// ImaginaryLiteral
typedef typeof(17.0i) imaginary_literal;

// StringLiteral
const char *hello = "Hello" "PCH" "World";

// CharacterLiteral
typedef typeof('a') char_literal;

// UnaryOperator
typedef typeof(-Enumerator) negate_enum;

// SizeOfAlignOfExpr
typedef typeof(sizeof(int)) typeof_sizeof;
typedef typeof(sizeof(Enumerator)) typeof_sizeof2;

// ArraySubscriptExpr
extern double values[];
typedef typeof(values[2]) array_subscript;

// CallExpr
double dplus(double x, double y);
double d0, d1;
typedef typeof((&dplus)(d0, d1)) call_returning_double;

// MemberExpr
struct S {
  double x;
};
typedef typeof(((struct S*)0)->x) member_ref_double;

// BinaryOperator
typedef typeof(i + Enumerator) add_result;

// CompoundAssignOperator
typedef typeof(i += Enumerator) addeq_result;

// ConditionalOperator
typedef typeof(i? : d0) conditional_operator;

// CStyleCastExpr
typedef typeof((void *)0) void_ptr;

// CompoundLiteral
typedef typeof((struct S){.x = 3.5}) compound_literal;

// ExtVectorElementExpr
typedef __attribute__(( ext_vector_type(2) )) double double2;
extern double2 vec2, vec2b;
typedef typeof(vec2.x) ext_vector_element;

// InitListExpr
double double_array[3] = { 1.0, 2.0 };

// DesignatedInitExpr
struct {
  int x;
  float y;
} designated_inits[3] = { [0].y = 17, [2].x = 12.3, 3.5 };

// TypesCompatibleExpr
typedef typeof(__builtin_types_compatible_p(float, double)) types_compatible;

// ChooseExpr
typedef typeof(__builtin_choose_expr(17 > 19, d0, 1)) choose_expr;

// GNUNullExpr FIXME: needs C++
// typedef typeof(__null) null_type;

// ShuffleVectorExpr
typedef typeof(__builtin_shufflevector(vec2, vec2b, 2, 1)) shuffle_expr;
OpenPOWER on IntegriCloud