1 | // RUN: %clang_cc1 -std=c++11 -ast-print -fms-extensions %s | FileCheck %s |
2 | // |
3 | // CHECK: int x __attribute__((aligned(4))); |
4 | int x __attribute__((aligned(4))); |
5 | |
6 | // FIXME: Print this at a valid location for a __declspec attr. |
7 | // CHECK: int y __declspec(align(4)); |
8 | __declspec(align(4)) int y; |
9 | |
10 | // CHECK: int z {{\[}}[gnu::aligned(4)]]; |
11 | int z [[gnu::aligned(4)]]; |
12 | |
13 | // CHECK: __attribute__((deprecated("warning"))); |
14 | int a __attribute__((deprecated("warning"))); |
15 | |
16 | // CHECK: int b {{\[}}[gnu::deprecated("warning")]]; |
17 | int b [[gnu::deprecated("warning")]]; |
18 | |
19 | // CHECK: __declspec(deprecated("warning")) |
20 | __declspec(deprecated("warning")) int c; |
21 | |
22 | // CHECK: int d {{\[}}[deprecated("warning")]]; |
23 | int d [[deprecated("warning")]]; |
24 | |
25 | // CHECK: __attribute__((deprecated("warning", "fixit"))); |
26 | int e __attribute__((deprecated("warning", "fixit"))); |
27 | |
28 | // CHECK: int cxx11_alignas alignas(4); |
29 | alignas(4) int cxx11_alignas; |
30 | |
31 | // CHECK: int c11_alignas _Alignas(alignof(int)); |
32 | _Alignas(int) int c11_alignas; |
33 | |
34 | // CHECK: void foo() __attribute__((const)); |
35 | void foo() __attribute__((const)); |
36 | |
37 | // CHECK: void bar() __attribute__((__const)); |
38 | void bar() __attribute__((__const)); |
39 | |
40 | // CHECK: int f1() __attribute__((warn_unused_result)); |
41 | int f1() __attribute__((warn_unused_result)); |
42 | |
43 | // CHECK: {{\[}}[clang::warn_unused_result]]; |
44 | int f2 [[clang::warn_unused_result]] (); |
45 | |
46 | // CHECK: {{\[}}[gnu::warn_unused_result]]; |
47 | int f3 [[gnu::warn_unused_result]] (); |
48 | |
49 | // FIXME: ast-print need to print C++11 |
50 | // attribute after function declare-id. |
51 | // CHECK: {{\[}}[noreturn]]; |
52 | void f4 [[noreturn]] (); |
53 | |
54 | // CHECK: __attribute__((gnu_inline)); |
55 | inline void f6() __attribute__((gnu_inline)); |
56 | |
57 | // CHECK: {{\[}}[gnu::gnu_inline]]; |
58 | inline void f7 [[gnu::gnu_inline]] (); |
59 | |
60 | // arguments printing |
61 | // CHECK: __attribute__((format(printf, 2, 3))); |
62 | void f8 (void *, const char *, ...) __attribute__ ((format (printf, 2, 3))); |
63 | |
64 | // CHECK: int m __attribute__((aligned(4 |
65 | // CHECK: int n alignas(4 |
66 | // CHECK: static int f() __attribute__((pure)) |
67 | // CHECK: static int g() {{\[}}[gnu::pure]] |
68 | template <typename T> struct S { |
69 | __attribute__((aligned(4))) int m; |
70 | alignas(4) int n; |
71 | __attribute__((pure)) static int f() { |
72 | return 0; |
73 | } |
74 | [[gnu::pure]] static int g() { |
75 | return 1; |
76 | } |
77 | }; |
78 | |
79 | // CHECK: int m __attribute__((aligned(4 |
80 | // CHECK: int n alignas(4 |
81 | // CHECK: static int f() __attribute__((pure)) |
82 | // CHECK: static int g() {{\[}}[gnu::pure]] |
83 | template struct S<int>; |
84 | |
85 | // CHECK: using Small2 {{\[}}[gnu::mode(byte)]] = int; |
86 | using Small2 [[gnu::mode(byte)]] = int; |
87 | |