1 // RUN: %clang_cc1 -triple i686-mingw32 -ast-dump %s | FileCheck %s
2 // RUN: %clang_cc1 -triple i686-mingw32 -std=c++1z -ast-dump %s | FileCheck %s -check-prefix=CHECK-1Z
11 class A
{ public: A(int = 0) {} };
16 // CHECK: VarDecl {{0x[0-9a-fA-F]+}} <line:[[@LINE+1]]:1, col:36> col:15 ImplicitConstrArray 'foo::A[2]'
17 static foo::A ImplicitConstrArray
[2];
20 // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::A *'
21 P
<foo::A
> p14
= new foo::A
;
22 // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::B *'
23 P
<foo::B
> p24
= new foo::B
;
24 // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::C *'
25 P
<foo::C
> pr4
= new foo::C
;
29 // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:10, col:17> 'foo::A'
33 void destruct(foo::A
*a1
, foo::A
*a2
, P
<int> *p1
) {
34 // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:8> '<bound member function type>' ->~A
36 // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:16> '<bound member function type>' ->~A
38 // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:13> '<bound member function type>' ->~P
50 // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'A':'foo::A' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
52 // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'D':'D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
57 template <class T
> void f() { T
{}; }
59 // CHECK: CXXTemporaryObjectExpr {{.*}} <col:31, col:33> 'PR38987::A':'PR38987::A'
62 void abort() __attribute__((noreturn
));
65 typedef decltype(sizeof(int)) size_t;
67 template <typename E
> struct initializer_list
{
70 initializer_list(const E
*p
, size_t n
) : p(p
), n(n
) {}
73 template <typename F
, typename S
> struct pair
{
76 pair(const F
&f
, const S
&s
) : f(f
), s(s
) {}
82 string(const char *S
) : str(S
) {}
83 ~string() { abort(); }
86 template<typename K
, typename V
>
89 map(initializer_list
<T
> i
, const string
&s
= string()) {}
95 // CHECK: NamespaceDecl {{.*}} attributed_decl
96 namespace attributed_decl
{
98 // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:28>
99 [[maybe_unused
]] int i1
;
100 // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:35>
101 __attribute__((unused
)) int i2
;
102 // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:35>
103 int __attribute__((unused
)) i3
;
104 // CHECK: DeclStmt {{.*}} <<built-in>:{{.*}}, {{.*}}:[[@LINE+1]]:40>
105 __declspec(dllexport
) extern int i4
;
106 // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:40>
107 extern int __declspec(dllexport
) i5
;
111 // CHECK-1Z: NamespaceDecl {{.*}} attributed_case
112 namespace attributed_case
{
117 // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+4]]:35>
118 // CHECK: FallThroughAttr {{.*}} <line:[[@LINE+1]]:20>
119 __attribute__((fallthrough
))
120 // CHECK: FallThroughAttr {{.*}} <line:[[@LINE+1]]:22>
121 __attribute__((fallthrough
));
127 } // namespace attributed_case
129 // CHECK: NamespaceDecl {{.*}} attributed_stmt
130 namespace attributed_stmt
{
131 // In DO_PRAGMA and _Pragma cases, `LoopHintAttr` comes from <scratch space>
134 #define DO_PRAGMA(x) _Pragma (#x)
137 // CHECK: AttributedStmt {{.*}} <line:[[@LINE-3]]:24, line:[[@LINE+2]]:33>
138 DO_PRAGMA (unroll(2))
139 for (int i
= 0; i
< 10; ++i
);
141 // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+3]]:33>
142 // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:13, col:22>
144 for (int i
= 0; i
< 10; ++i
);
146 // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+5]]:33>
147 // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:19, col:41>
148 #pragma clang loop vectorize(enable)
149 // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:19, col:42>
150 #pragma clang loop interleave(enable)
151 for (int i
= 0; i
< 10; ++i
);
153 // CHECK: AttributedStmt {{.*}} <line:[[@LINE+1]]:5, line:[[@LINE+2]]:33>
155 for (int i
= 0; i
< 10; ++i
);
159 #if __cplusplus >= 201703L
160 // CHECK-1Z: FunctionDecl {{.*}} construct_with_init_list
161 std::map
<int, int> construct_with_init_list() {
162 // CHECK-1Z-NEXT: CompoundStmt
163 // CHECK-1Z-NEXT: ReturnStmt {{.*}} <line:[[@LINE+5]]:3, col:35
164 // CHECK-1Z-NEXT: ExprWithCleanups {{.*}} <col:10, col:35
165 // CHECK-1Z-NEXT: CXXBindTemporaryExpr {{.*}} <col:10, col:35
166 // CHECK-1Z-NEXT: CXXTemporaryObjectExpr {{.*}} <col:10, col:35
167 // CHECK-1Z-NEXT: CXXStdInitializerListExpr {{.*}} <col:28, col:35
168 return std::map
<int, int>{{0, 0}};
171 // CHECK-1Z: NamespaceDecl {{.*}} in_class_init
172 namespace in_class_init
{
175 // CHECK-1Z: CXXRecordDecl {{.*}} struct B definition
177 // CHECK-1Z: FieldDecl {{.*}} a 'A':'in_class_init::A'
178 // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:11, col:12
183 // CHECK-1Z: NamespaceDecl {{.*}} delegating_constructor_init
184 namespace delegating_constructor_init
{
192 // CHECK-1Z: CXXRecordDecl {{.*}} struct C definition
194 // CHECK-1Z: CXXConstructorDecl {{.*}} C
195 // CHECK-1Z-NEXT: CXXCtorInitializer 'B':'delegating_constructor_init::B'
196 // CHECK-1Z-NEXT: CXXConstructExpr {{.*}} <col:11, col:15
197 // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:13, col:14
202 // CHECK-1Z: NamespaceDecl {{.*}} new_init
205 // CHECK-1Z: CXXNewExpr {{.*}} <line:[[@LINE+2]]:5, col:14
206 // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:12, col:14