blob: b0e421410b24b87b5fbb55ab9b51428d54a68979 [file] [log] [blame]
David Blaikie8fab8e52012-11-12 19:12:12 +00001// RUN: %clang_cc1 %s -ast-print | FileCheck %s
Chris Lattnere5a91b42007-12-03 21:43:25 +00002
3typedef void func_typedef();
4func_typedef xxx;
5
Chris Lattnerb36a98e2007-12-06 17:20:20 +00006typedef void func_t(int x);
7func_t a;
Chris Lattnere5a91b42007-12-03 21:43:25 +00008
David Blaikie8fab8e52012-11-12 19:12:12 +00009struct blah {
10 struct {
11 struct {
12 int b;
13 };
14 };
15};
16
17int foo(const struct blah *b) {
18 // CHECK: return b->b;
19 return b->b;
20}
Hal Finkelf3e02652014-07-18 23:19:20 +000021
22int arr(int a[static 3]) {
23 // CHECK: int a[static 3]
24 return a[2];
25}
26
Hal Finkelbfe2d3c2014-07-19 02:01:03 +000027int rarr(int a[restrict static 3]) {
28 // CHECK: int a[restrict static 3]
29 return a[2];
30}
31
Hal Finkelf3e02652014-07-18 23:19:20 +000032int varr(int n, int a[static n]) {
33 // CHECK: int a[static n]
34 return a[2];
35}
36
Hal Finkelbfe2d3c2014-07-19 02:01:03 +000037int rvarr(int n, int a[restrict static n]) {
38 // CHECK: int a[restrict static n]
39 return a[2];
40}
41
Aaron Ballmanc960f562014-08-01 13:49:00 +000042typedef struct {
43 int f;
44} T __attribute__ ((__aligned__));
Aaron Ballman53885382014-09-15 16:45:30 +000045
46// CHECK: struct __attribute__((visibility("default"))) S;
47struct __attribute__((visibility("default"))) S;
Justin Bognercb337032015-05-28 22:19:36 +000048
49struct pair_t {
50 int a;
51 int b;
52};
53
54// CHECK: struct pair_t p = {a: 3, .b = 4};
55struct pair_t p = {a: 3, .b = 4};
Benjamin Kramer54f81ed2016-01-25 10:34:06 +000056
57void initializers() {
58 // CHECK: int *x = ((void *)0), *y = ((void *)0);
59 int *x = ((void *)0), *y = ((void *)0);
60 struct Z{};
61 struct {
62 struct Z z;
63 // CHECK: } z = {(struct Z){}};
64 } z = {(struct Z){}};
65}