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