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