| David Blaikie | 8fab8e5 | 2012-11-12 19:12:12 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -ast-print | FileCheck %s |
| Chris Lattner | e5a91b4 | 2007-12-03 21:43:25 +0000 | [diff] [blame] | 2 | |
| 3 | typedef void func_typedef(); |
| 4 | func_typedef xxx; |
| 5 | |
| Chris Lattner | b36a98e | 2007-12-06 17:20:20 +0000 | [diff] [blame] | 6 | typedef void func_t(int x); |
| 7 | func_t a; |
| Chris Lattner | e5a91b4 | 2007-12-03 21:43:25 +0000 | [diff] [blame] | 8 | |
| David Blaikie | 8fab8e5 | 2012-11-12 19:12:12 +0000 | [diff] [blame] | 9 | struct blah { |
| 10 | struct { |
| 11 | struct { |
| 12 | int b; |
| 13 | }; |
| 14 | }; |
| 15 | }; |
| 16 | |
| 17 | int foo(const struct blah *b) { |
| 18 | // CHECK: return b->b; |
| 19 | return b->b; |
| 20 | } |
| Hal Finkel | f3e0265 | 2014-07-18 23:19:20 +0000 | [diff] [blame] | 21 | |
| 22 | int arr(int a[static 3]) { |
| 23 | // CHECK: int a[static 3] |
| 24 | return a[2]; |
| 25 | } |
| 26 | |
| Hal Finkel | bfe2d3c | 2014-07-19 02:01:03 +0000 | [diff] [blame] | 27 | int rarr(int a[restrict static 3]) { |
| 28 | // CHECK: int a[restrict static 3] |
| 29 | return a[2]; |
| 30 | } |
| 31 | |
| Hal Finkel | f3e0265 | 2014-07-18 23:19:20 +0000 | [diff] [blame] | 32 | int varr(int n, int a[static n]) { |
| 33 | // CHECK: int a[static n] |
| 34 | return a[2]; |
| 35 | } |
| 36 | |
| Hal Finkel | bfe2d3c | 2014-07-19 02:01:03 +0000 | [diff] [blame] | 37 | int rvarr(int n, int a[restrict static n]) { |
| 38 | // CHECK: int a[restrict static n] |
| 39 | return a[2]; |
| 40 | } |
| 41 | |
| Aaron Ballman | c960f56 | 2014-08-01 13:49:00 +0000 | [diff] [blame] | 42 | typedef struct { |
| 43 | int f; |
| 44 | } T __attribute__ ((__aligned__)); |
| Aaron Ballman | 5388538 | 2014-09-15 16:45:30 +0000 | [diff] [blame] | 45 | |
| 46 | // CHECK: struct __attribute__((visibility("default"))) S; |
| 47 | struct __attribute__((visibility("default"))) S; |
| Justin Bogner | cb33703 | 2015-05-28 22:19:36 +0000 | [diff] [blame] | 48 | |
| 49 | struct pair_t { |
| 50 | int a; |
| 51 | int b; |
| 52 | }; |
| 53 | |
| 54 | // CHECK: struct pair_t p = {a: 3, .b = 4}; |
| 55 | struct pair_t p = {a: 3, .b = 4}; |
| Benjamin Kramer | 54f81ed | 2016-01-25 10:34:06 +0000 | [diff] [blame^] | 56 | |
| 57 | void 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 | } |