xref: /aosp_15_r20/external/clang/test/SemaCXX/attr-print.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -ast-print -fms-extensions | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // CHECK: int x __attribute__((aligned(4)));
4*67e74705SXin Li int x __attribute__((aligned(4)));
5*67e74705SXin Li 
6*67e74705SXin Li // FIXME: Print this at a valid location for a __declspec attr.
7*67e74705SXin Li // CHECK: int y __declspec(align(4));
8*67e74705SXin Li __declspec(align(4)) int y;
9*67e74705SXin Li 
10*67e74705SXin Li // CHECK: void foo() __attribute__((const));
11*67e74705SXin Li void foo() __attribute__((const));
12*67e74705SXin Li 
13*67e74705SXin Li // CHECK: void bar() __attribute__((__const));
14*67e74705SXin Li void bar() __attribute__((__const));
15*67e74705SXin Li 
16*67e74705SXin Li // FIXME: Print this with correct format and order.
17*67e74705SXin Li // CHECK: void foo1() __attribute__((pure)) __attribute__((noinline));
18*67e74705SXin Li void foo1() __attribute__((noinline, pure));
19*67e74705SXin Li 
20*67e74705SXin Li // CHECK: typedef int Small1 __attribute__((mode(byte)));
21*67e74705SXin Li typedef int Small1 __attribute__((mode(byte)));
22*67e74705SXin Li 
23*67e74705SXin Li // CHECK: int small __attribute__((mode(byte)));
24*67e74705SXin Li int small __attribute__((mode(byte)));
25*67e74705SXin Li 
26*67e74705SXin Li // CHECK: int v __attribute__((visibility("hidden")));
27*67e74705SXin Li int v __attribute__((visibility("hidden")));
28*67e74705SXin Li 
29*67e74705SXin Li // CHECK: char *PR24565() __attribute__((malloc))
30*67e74705SXin Li char *PR24565() __attribute__((__malloc__));
31*67e74705SXin Li 
32*67e74705SXin Li // CHECK: class __attribute__((consumable("unknown"))) AttrTester1
33*67e74705SXin Li class __attribute__((consumable(unknown))) AttrTester1 {
34*67e74705SXin Li   // CHECK: void callableWhen() __attribute__((callable_when("unconsumed", "consumed")));
35*67e74705SXin Li   void callableWhen()  __attribute__((callable_when("unconsumed", "consumed")));
36*67e74705SXin Li };
37