[InstCombine] Preserve NSW flags for `lshr (mul nuw X, C1), C2 -> mul nuw nsw X,...
[llvm-project.git] / clang / test / AST / ast-print-enum-decl.c
blob411467348fb1172af9b5056e1b5d33415744f138
1 // First check compiling and printing of this file.
2 //
3 // RUN: %clang_cc1 -verify -ast-print %s > %t.c
4 // RUN: FileCheck --check-prefixes=CHECK,PRINT %s --input-file %t.c
5 //
6 // Now check compiling and printing of the printed file.
7 //
8 // RUN: echo "// expected""-warning@* 6 {{'T' is deprecated}}" >> %t.c
9 // RUN: echo "// expected""-note@* 6 {{'T' has been explicitly marked deprecated here}}" >> %t.c
11 // RUN: %clang_cc1 -verify -ast-print -Wno-strict-prototypes %t.c \
12 // RUN: | FileCheck --check-prefixes=CHECK,PRINT %s
14 // END.
16 // CHECK-LABEL: defFirst
17 void defFirst(void) {
18 // PRINT-NEXT: enum
19 // PRINT-DAG: __attribute__((aligned(16)))
20 // PRINT-DAG: __attribute__((deprecated("")))
21 // PRINT-SAME: T {
22 // PRINT-NEXT: E0,
23 // PRINT-NEXT: E1
24 // PRINT-NEXT: } *p0;
25 // expected-warning@+2 {{'T' is deprecated}}
26 // expected-note@+1 2 {{'T' has been explicitly marked deprecated here}}
27 enum __attribute__((aligned(16))) __attribute__((deprecated(""))) T {
28 E0, E1
29 } *p0;
31 // PRINT-NEXT: enum T *p1;
32 enum T *p1; // expected-warning {{'T' is deprecated}}
35 // CHECK-LABEL: defLast
36 void defLast(void) {
37 // PRINT-NEXT: enum __attribute__((aligned(16))) T *p0;
38 enum __attribute__((aligned(16))) T *p0;
40 // PRINT-NEXT: enum __attribute__((deprecated(""))) T {
41 // PRINT-NEXT: E0,
42 // PRINT-NEXT: E1
43 // PRINT-NEXT: } *p1;
44 // expected-warning@+2 {{'T' is deprecated}}
45 // expected-note@+1 {{'T' has been explicitly marked deprecated here}}
46 enum __attribute__((deprecated(""))) T { E0, E1 } *p1;
49 // CHECK-LABEL: defMiddle
50 void defMiddle(void) {
51 // PRINT-NEXT: enum __attribute__((deprecated(""))) T *p0;
52 // expected-warning@+2 {{'T' is deprecated}}
53 // expected-note@+1 3 {{'T' has been explicitly marked deprecated here}}
54 enum __attribute__((deprecated(""))) T *p0;
56 // PRINT-NEXT: enum __attribute__((aligned(16))) T {
57 // PRINT-NEXT: E0
58 // PRINT-NEXT: E1
59 // PRINT-NEXT: } *p1;
60 enum __attribute__((aligned(16))) T { E0, E1 } *p1; // expected-warning {{'T' is deprecated}}
62 // PRINT-NEXT: enum T *p2;
63 enum T *p2; // expected-warning {{'T' is deprecated}}
66 // CHECK-LABEL: declsOnly
67 void declsOnly(void) {
68 // FIXME: For some reason, attributes are ignored if they're not on the first
69 // declaration and not on the definition.
71 // PRINT-NEXT: enum __attribute__((aligned)) T *p0;
72 enum __attribute__((aligned)) T *p0;
74 // PRINT-NEXT: enum T *p1;
75 enum __attribute__((may_alias)) T *p1;
77 // PRINT-NEXT: enum T *p2;
78 enum T *p2;
80 // PRINT-NEXT: enum T *p3;
81 enum __attribute__((deprecated(""))) T *p3;
83 // PRINT-NEXT: enum T *p4;
84 enum T *p4;
87 // Check that tag decl groups stay together in decl contexts.
89 // PRINT-LABEL: enum DeclGroupAtFileScope {
90 // PRINT-NEXT: DeclGroupAtFileScope0
91 // PRINT-NEXT: } *DeclGroupAtFileScopePtr;
92 enum DeclGroupAtFileScope { DeclGroupAtFileScope0 } *DeclGroupAtFileScopePtr;
94 // PRINT-LABEL: struct DeclGroupInMemberList
95 struct DeclGroupInMemberList {
96 // PRINT-NEXT: enum T1 {
97 // PRINT-NEXT: T10
98 // PRINT-NEXT: } *p0;
99 enum T1 { T10 } *p0;
100 // PRINT-NEXT: enum T2 {
101 // PRINT-NEXT: T20
102 // PRINT-NEXT: } *p1, *p2;
103 enum T2 { T20 } *p1, *p2;
104 // PRINT-NEXT: };
107 enum fixedEnum : int { fixedEnumerator };
108 // PRINT-LABEL: enum fixedEnum : int {
109 // PRINT-NEXT: fixedEnumerator
110 // PRINT-NEXT: };