// RUN: %clang_cc1 -triple i686-mingw32 -ast-dump %s | FileCheck %s // RUN: %clang_cc1 -triple i686-mingw32 -std=c++1z -ast-dump %s | FileCheck %s -check-prefix=CHECK-1Z template class P { public: P(T* t) {} }; namespace foo { class A { public: A(int = 0) {} }; enum B {}; typedef int C; } // CHECK: VarDecl {{0x[0-9a-fA-F]+}} col:15 ImplicitConstrArray 'foo::A [2]' static foo::A ImplicitConstrArray[2]; int main() { // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} 'foo::A *' P p14 = new foo::A; // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} 'foo::B *' P p24 = new foo::B; // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} 'foo::C *' P pr4 = new foo::C; } foo::A getName() { // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} 'foo::A' return foo::A(); } void destruct(foo::A *a1, foo::A *a2, P *p1) { // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} '' ->~A a1->~A(); // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} '' ->~A a2->foo::A::~A(); // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} '' ->~P p1->~P(); } struct D { D(int); ~D(); }; void construct() { using namespace foo; A a = A(12); // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} 'foo::A' 'void (int){{( __attribute__\(\(thiscall\)\))?}}' D d = D(12); // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} 'D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}' } namespace PR38987 { struct A { A(); }; template void f() { T{}; } template void f(); // CHECK: CXXTemporaryObjectExpr {{.*}} 'PR38987::A':'PR38987::A' } void abort() __attribute__((noreturn)); namespace std { typedef decltype(sizeof(int)) size_t; template struct initializer_list { const E *p; size_t n; initializer_list(const E *p, size_t n) : p(p), n(n) {} }; template struct pair { F f; S s; pair(const F &f, const S &s) : f(f), s(s) {} }; struct string { const char *str; string() { abort(); } string(const char *S) : str(S) {} ~string() { abort(); } }; template struct map { using T = pair; map(initializer_list i, const string &s = string()) {} ~map() { abort(); } }; }; // namespace std // CHECK: NamespaceDecl {{.*}} attributed_decl namespace attributed_decl { void f() { // CHECK: DeclStmt {{.*}} [[maybe_unused]] int i1; // CHECK: DeclStmt {{.*}} __attribute__((unused)) int i2; // CHECK: DeclStmt {{.*}} int __attribute__((unused)) i3; // CHECK: DeclStmt {{.*}} <:{{.*}}, {{.*}}:[[@LINE+1]]:40> __declspec(dllexport) extern int i4; // CHECK: DeclStmt {{.*}} extern int __declspec(dllexport) i5; } } // CHECK: NamespaceDecl {{.*}} attributed_stmt namespace attributed_stmt { // In DO_PRAGMA and _Pragma cases, `LoopHintAttr` comes from // file. #define DO_PRAGMA(x) _Pragma (#x) void f() { // CHECK: AttributedStmt {{.*}} DO_PRAGMA (unroll(2)) for (int i = 0; i < 10; ++i); // CHECK: AttributedStmt {{.*}} // CHECK: LoopHintAttr {{.*}} #pragma unroll(2) for (int i = 0; i < 10; ++i); // CHECK: AttributedStmt {{.*}} // CHECK: LoopHintAttr {{.*}} #pragma clang loop vectorize(enable) // CHECK: LoopHintAttr {{.*}} #pragma clang loop interleave(enable) for (int i = 0; i < 10; ++i); // CHECK: AttributedStmt {{.*}} _Pragma("unroll(2)") for (int i = 0; i < 10; ++i); } } #if __cplusplus >= 201703L // CHECK-1Z: FunctionDecl {{.*}} construct_with_init_list std::map construct_with_init_list() { // CHECK-1Z-NEXT: CompoundStmt // CHECK-1Z-NEXT: ReturnStmt {{.*}} {{0, 0}}; } // CHECK-1Z: NamespaceDecl {{.*}} in_class_init namespace in_class_init { struct A {}; // CHECK-1Z: CXXRecordDecl {{.*}} struct B definition struct B { // CHECK-1Z: FieldDecl {{.*}} a 'in_class_init::A' // CHECK-1Z-NEXT: InitListExpr {{.*}}