[RISCV] Add shrinkwrap test cases showing gaps in current impl
[llvm-project.git] / clang / test / PCH / types.c
bloba9617b6a7cc6dbd213e48a13cdb8e3039ef6f3b0
1 // Test this without pch.
2 // RUN: %clang_cc1 -fblocks -include %S/types.h -fsyntax-only -verify -Wno-strict-prototypes %s
4 // Test with pch.
5 // RUN: %clang_cc1 -emit-pch -fblocks -Wno-strict-prototypes -o %t %S/types.h
6 // RUN: %clang_cc1 -fblocks -include-pch %t -verify -Wno-strict-prototypes %s -ast-print
8 typedef int INT;
9 INT int_value;
11 __attribute__((address_space(1))) int int_as_one;
13 // TYPE_EXT_QUAL
14 ASInt *as_int_ptr1 = &int_value; // expected-error{{changes address space of pointer}}
15 ASInt *as_int_ptr2 = &int_as_one;
17 // TYPE_COMPLEX
18 _Complex float Cfloat_val;
19 Cfloat *Cfloat_ptr = &Cfloat_val;
21 // TYPE_ATOMIC
22 _Atomic(int) AtomicInt_val;
23 AtomicInt *AtomicInt_ptr = &AtomicInt_val;
25 // TYPE_POINTER
26 int_ptr int_value_ptr = &int_value;
28 // TYPE_BLOCK_POINTER
29 void test_block_ptr(Block *bl) {
30 *bl = ^(int x, float f) { return x; };
33 // TYPE_CONSTANT_ARRAY
34 five_ints fvi = { 1, 2, 3, 4, 5 };
36 // TYPE_INCOMPLETE_ARRAY
37 float_array fa1 = { 1, 2, 3 };
38 float_array fa2 = { 1, 2, 3, 4, 5, 6, 7, 8 };
40 // TYPE_VARIABLE_ARRAY in stmts.[ch]
42 // TYPE_VECTOR
43 float4 f4 = { 1.0, 2.0, 3.0, 4.0 };
45 // TYPE_EXT_VECTOR
46 ext_float4 ef4 = { 1.0, 2.0, 3.0, 4.0 };
48 // TYPE_FUNCTION_NO_PROTO
49 noproto np1;
50 int np1(x, y)
51 int x;
52 float y;
54 return x;
57 // TYPE_FUNCTION_PROTO
58 proto p1;
59 float p1(float x, float y, ...) {
60 return x + y;
62 proto *p2 = p1;
64 // TYPE_TYPEDEF
65 int_ptr_ptr ipp = &int_value_ptr;
67 // TYPE_TYPEOF_EXPR
68 typeof_17 *t17 = &int_value;
69 struct S { int x, y; };
70 typeof_17 t17_2 = (struct S){1, 2}; // expected-error{{initializing 'typeof_17' (aka 'int') with an expression of incompatible type 'struct S'}}
72 // TYPE_TYPEOF
73 int_ptr_ptr2 ipp2 = &int_value_ptr;