xref: /llvm-project/clang/test/SemaCXX/attr-print.cpp (revision 818de32f31e8075657dd27938e4aeb1a46f3f631)
1 // RUN: %clang_cc1 %s -ast-print -fms-extensions | FileCheck %s
2 
3 // CHECK: int x __attribute__((aligned(4)));
4 int x __attribute__((aligned(4)));
5 
6 // CHECK: __declspec(align(4)) int y;
7 __declspec(align(4)) int y;
8 
9 // CHECK: int foo() __attribute__((const));
10 int foo() __attribute__((const));
11 
12 // CHECK: int bar() __attribute__((__const));
13 int bar() __attribute__((__const));
14 
15 // FIXME: Print this with correct format.
16 // CHECK: int foo1() __attribute__((noinline)) __attribute__((pure));
17 int foo1() __attribute__((noinline, pure));
18 
19 // CHECK: typedef int Small1 __attribute__((mode(byte)));
20 typedef int Small1 __attribute__((mode(byte)));
21 
22 // CHECK: int small __attribute__((mode(byte)));
23 int small __attribute__((mode(byte)));
24 
25 // CHECK: int v __attribute__((visibility("hidden")));
26 int v __attribute__((visibility("hidden")));
27 
28 // CHECK: char *PR24565() __attribute__((malloc))
29 char *PR24565() __attribute__((__malloc__));
30 
31 // CHECK: class __attribute__((consumable("unknown"))) AttrTester1
32 class __attribute__((consumable(unknown))) AttrTester1 {
33   // CHECK: void callableWhen() __attribute__((callable_when("unconsumed", "consumed")));
34   void callableWhen()  __attribute__((callable_when("unconsumed", "consumed")));
35 };
36 
37 // CHECK: class __single_inheritance SingleInheritance;
38 class __single_inheritance SingleInheritance;
39 
40 // CHECK: class __multiple_inheritance MultipleInheritance;
41 class __multiple_inheritance MultipleInheritance;
42 
43 // CHECK: class __virtual_inheritance VirtualInheritance;
44 class __virtual_inheritance VirtualInheritance;
45 
46 // CHECK: typedef double *aligned_double __attribute__((align_value(64)));
47 typedef double * __attribute__((align_value(64))) aligned_double;
48