// Test without serialization: // RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -ast-dump %s \ // RUN: | FileCheck --strict-whitespace %s // // Test with serialization: // RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -emit-pch -o %t %s // RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 \ // RUN: -include-pch %t -ast-dump-all /dev/null \ // RUN: | sed -e "s/ //" -e "s/ imported//" \ // RUN: | FileCheck --strict-whitespace %s namespace std { using size_t = decltype(sizeof(0)); class type_info { public: virtual ~type_info(); bool operator==(const type_info& rhs) const noexcept; bool operator!=(const type_info& rhs) const noexcept; type_info(const type_info& rhs) = delete; // cannot be copied type_info& operator=(const type_info& rhs) = delete; // cannot be copied }; class bad_typeid { public: bad_typeid() noexcept; bad_typeid(const bad_typeid&) noexcept; virtual ~bad_typeid(); bad_typeid& operator=(const bad_typeid&) noexcept; const char* what() const noexcept; }; } // namespace std void *operator new(std::size_t, void *ptr); struct S { virtual ~S() = default; void func(int); template Ty foo(); int i; }; struct T : S {}; template struct U {}; void Throw() { throw 12; // CHECK: CXXThrowExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 12 throw; // CHECK: CXXThrowExpr 0x{{[^ ]*}} 'void' } void PointerToMember(S obj1, S *obj2, int S::* data, void (S::*call)(int)) { obj1.*data; // CHECK: BinaryOperator 0x{{[^ ]*}} 'int' lvalue '.*' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S' lvalue ParmVar 0x{{[^ ]*}} 'obj1' 'S' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int S::*' lvalue ParmVar 0x{{[^ ]*}} 'data' 'int S::*' obj2->*data; // CHECK: BinaryOperator 0x{{[^ ]*}} 'int' lvalue '->*' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S *' lvalue ParmVar 0x{{[^ ]*}} 'obj2' 'S *' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int S::*' lvalue ParmVar 0x{{[^ ]*}} 'data' 'int S::*' (obj1.*call)(12); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: ParenExpr 0x{{[^ ]*}} '' // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} '' '.*' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S' lvalue ParmVar 0x{{[^ ]*}} 'obj1' 'S' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'void (S::*)(int)' lvalue ParmVar 0x{{[^ ]*}} 'call' 'void (S::*)(int)' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 12 (obj2->*call)(12); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: ParenExpr 0x{{[^ ]*}} '' // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} '' '->*' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S *' lvalue ParmVar 0x{{[^ ]*}} 'obj2' 'S *' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'void (S::*)(int)' lvalue ParmVar 0x{{[^ ]*}} 'call' 'void (S::*)(int)' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 12 } void Casting(const S *s) { // FIXME: The cast expressions contain "struct S" instead of "S". const_cast(s); // CHECK: CXXConstCastExpr 0x{{[^ ]*}} 'S *' const_cast // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}} 'const S *' part_of_explicit_cast // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const S *' lvalue ParmVar 0x{{[^ ]*}} 's' 'const S *' static_cast(s); // CHECK: CXXStaticCastExpr 0x{{[^ ]*}} 'const T *' static_cast // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}} 'const S *' part_of_explicit_cast // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const S *' lvalue ParmVar 0x{{[^ ]*}} 's' 'const S *' dynamic_cast(s); // CHECK: CXXDynamicCastExpr 0x{{[^ ]*}} 'const T *' dynamic_cast // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}} 'const S *' part_of_explicit_cast // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const S *' lvalue ParmVar 0x{{[^ ]*}} 's' 'const S *' reinterpret_cast(s); // CHECK: CXXReinterpretCastExpr 0x{{[^ ]*}} 'const int *' reinterpret_cast // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}} 'const S *' part_of_explicit_cast // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const S *' lvalue ParmVar 0x{{[^ ]*}} 's' 'const S *' } template void UnaryExpressions(int *p) { sizeof...(Ts); // CHECK: SizeOfPackExpr 0x{{[^ ]*}} 'unsigned long' 0x{{[^ ]*}} Ts noexcept(p - p); // CHECK: CXXNoexceptExpr 0x{{[^ ]*}} 'bool' // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} 'long' '-' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'int *' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'int *' ::new int; // CHECK: CXXNewExpr 0x{{[^ ]*}} 'int *' global Function 0x{{[^ ]*}} 'operator new' 'void *(unsigned long)' new (int); // CHECK: CXXNewExpr 0x{{[^ ]*}} 'int *' Function 0x{{[^ ]*}} 'operator new' 'void *(unsigned long)' new int{12}; // CHECK: CXXNewExpr 0x{{[^ ]*}} 'int *' Function 0x{{[^ ]*}} 'operator new' 'void *(unsigned long)' // CHECK-NEXT: InitListExpr 0x{{[^ ]*}} 'int' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 12 new int[2]; // CHECK: CXXNewExpr 0x{{[^ ]*}} 'int *' array Function 0x{{[^ ]*}} 'operator new[]' 'void *(unsigned long)' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 2 new int[2]{1, 2}; // CHECK: CXXNewExpr 0x{{[^ ]*}} 'int *' array Function 0x{{[^ ]*}} 'operator new[]' 'void *(unsigned long)' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 2 // CHECK-NEXT: InitListExpr 0x{{[^ ]*}} 'int [2]' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 1 // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 2 new (p) int; // CHECK: CXXNewExpr 0x{{[^ ]*}} 'int *' Function 0x{{[^ ]*}} 'operator new' 'void *(std::size_t, void *)' // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void *' // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int *' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'int *' new (p) int{12}; // CHECK: CXXNewExpr 0x{{[^ ]*}} 'int *' Function 0x{{[^ ]*}} 'operator new' 'void *(std::size_t, void *)' // CHECK-NEXT: InitListExpr 0x{{[^ ]*}} 'int' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 12 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void *' // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int *' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'int *' ::delete p; // CHECK: CXXDeleteExpr 0x{{[^ ]*}} 'void' global Function 0x{{[^ ]*}} 'operator delete' 'void (void *) noexcept' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'int *' delete [] p; // CHECK: CXXDeleteExpr 0x{{[^ ]*}} 'void' array Function 0x{{[^ ]*}} 'operator delete[]' 'void (void *) noexcept' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'int *' } void PostfixExpressions(S a, S *p, U *r) { a.func(0); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' .func 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 0 p->func(0); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' ->func 0x{{[^ ]*}} // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'S *' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 0 // FIXME: there is no mention that this used the template keyword. p->template foo(); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'int':'int' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' ->foo 0x{{[^ ]*}} // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'S *' // FIXME: there is no mention that this used the template keyword. a.template foo(); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'float':'float' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' .foo 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S' p->~S(); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' ->~S 0x{{[^ ]*}} // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'S *' a.~S(); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' .~S 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S' // FIXME: there seems to be no way to distinguish the construct below from // the construct above. a.~decltype(a)(); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' .~S 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S' // FIXME: similarly, there is no way to distinguish the construct below from // the p->~S() case. p->::S::~S(); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' ->~S 0x{{[^ ]*}} // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S *' lvalue ParmVar 0x{{[^ ]*}} 'p' 'S *' // FIXME: there is no mention that this used the template keyword. r->template U::~U(); // CHECK: CXXMemberCallExpr 0x{{[^ ]*}} 'void' // CHECK-NEXT: MemberExpr 0x{{[^ ]*}} '' ->~U 0x{{[^ ]*}} // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'U *' lvalue ParmVar 0x{{[^ ]*}} 'r' 'U *' typeid(a); // CHECK: CXXTypeidExpr 0x{{[^ ]*}} 'const std::type_info' lvalue // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S' // FIXME: no type information is printed for the argument. typeid(S); // CHECK: CXXTypeidExpr 0x{{[^ ]*}} 'const std::type_info' lvalue } template void PrimaryExpressions(Ts... a) { struct V { void f() { this; // CHECK: CXXThisExpr 0x{{[^ ]*}} 'V *' this [this]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:7 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl // CHECK-NEXT: CompoundStmt // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:8 implicit 'V *' // CHECK-NEXT: ParenListExpr // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} 'V *' this [*this]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:7 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl // CHECK-NEXT: CompoundStmt // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:8 implicit 'V' // CHECK-NEXT: ParenListExpr 0x{{[^ ]*}} 'NULL TYPE' // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} '' prefix '*' cannot overflow // CHECK-NEXT: CXXThisExpr 0x{{[^ ]*}} 'V *' this } }; int b, c; [](){}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CXXConversionDecl 0x{{[^ ]*}} col:3 implicit constexpr operator auto (*)() 'auto (*() const noexcept)()' inline // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto ()' static inline // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} [](int a, ...){}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto (int, ...) const' inline // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:10 a 'int' // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CXXConversionDecl 0x{{[^ ]*}} col:3 implicit constexpr operator auto (*)(int, ...) 'auto (*() const noexcept)(int, ...)' inline // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto (int, ...)' static inline // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}} col:10 a 'int' // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} [a...]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> auto' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:4 implicit 'Ts...' // CHECK-NEXT: ParenListExpr 0x{{[^ ]*}} 'NULL TYPE' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'Ts' lvalue ParmVar 0x{{[^ ]*}} 'a' 'Ts...' // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} [=]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> auto' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} [=] { return b; }; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> auto' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const int' lvalue Var 0x{{[^ ]*}} 'b' 'int' // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const int' lvalue Var 0x{{[^ ]*}} 'b' 'int' [&]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> auto' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} [&] { return c; }; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> auto' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int' lvalue Var 0x{{[^ ]*}} 'c' 'int' // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int' lvalue Var 0x{{[^ ]*}} 'c' 'int' [b, &c]{ return b + c; }; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> auto' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} 'int' '+' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const int' lvalue Var 0x{{[^ ]*}} 'b' 'int' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int' lvalue Var 0x{{[^ ]*}} 'c' 'int' // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:4 implicit 'int' // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:8 implicit 'int &' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int' lvalue Var 0x{{[^ ]*}} 'b' 'int' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int' lvalue Var 0x{{[^ ]*}} 'c' 'int' // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} 'int' '+' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'const int' lvalue Var 0x{{[^ ]*}} 'b' 'int' // CHECK-NEXT: ImplicitCastExpr // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int' lvalue Var 0x{{[^ ]*}} 'c' 'int' [a..., x = 12]{}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> auto' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:4 implicit 'Ts...' // CHECK-NEXT: FieldDecl 0x{{[^ ]*}} col:10 implicit 'int':'int' // CHECK-NEXT: ParenListExpr 0x{{[^ ]*}} 'NULL TYPE' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'Ts' lvalue ParmVar 0x{{[^ ]*}} 'a' 'Ts...' // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 12 // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} []() constexpr {}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 constexpr operator() 'auto () const' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CXXConversionDecl 0x{{[^ ]*}} col:3 implicit constexpr operator auto (*)() 'auto (*() const noexcept)()' inline // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto ()' static inline // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} []() mutable {}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto ()' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CXXConversionDecl 0x{{[^ ]*}} col:3 implicit constexpr operator auto (*)() 'auto (*() const noexcept)()' inline // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto ()' static inline // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} []() noexcept {}; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const noexcept' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CXXConversionDecl 0x{{[^ ]*}} col:3 implicit constexpr operator auto (*)() noexcept 'auto (*() const noexcept)() noexcept' inline // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto () noexcept' static inline // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} []() -> int { return 0; }; // CHECK: LambdaExpr 0x{{[^ ]*}} '(lambda at {{.*}}:[[@LINE-1]]:3)' // CHECK-NEXT: CXXRecordDecl 0x{{[^ ]*}} col:3 implicit class definition // CHECK-NEXT: DefinitionData lambda // CHECK-NEXT: DefaultConstructor // CHECK-NEXT: CopyConstructor // CHECK-NEXT: MoveConstructor // CHECK-NEXT: CopyAssignment // CHECK-NEXT: MoveAssignment // CHECK-NEXT: Destructor // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 operator() 'auto () const -> int' inline // CHECK-NEXT: CompoundStmt // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 0 // CHECK-NEXT: CXXConversionDecl 0x{{[^ ]*}} col:3 implicit constexpr operator int (*)() 'auto (*() const noexcept)() -> int' inline // CHECK-NEXT: CXXMethodDecl 0x{{[^ ]*}} col:3 implicit __invoke 'auto () -> int' static inline // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} 'int' 0 (a + ...); // CHECK: CXXFoldExpr 0x{{[^ ]*}} '' // CHECK-NEXT: <<>> // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'Ts' lvalue ParmVar 0x{{[^ ]*}} 'a' 'Ts...' // CHECK-NEXT: <<>> (... + a); // CHECK: CXXFoldExpr 0x{{[^ ]*}} '' // CHECK-NEXT: <<>> // CHECK-NEXT: <<>> // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'Ts' lvalue ParmVar 0x{{[^ ]*}} 'a' 'Ts...' (a + ... + b); // CHECK: CXXFoldExpr 0x{{[^ ]*}} '' // CHECK-NEXT: <<>> // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'Ts' lvalue ParmVar 0x{{[^ ]*}} 'a' 'Ts...' // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} 'int' lvalue Var 0x{{[^ ]*}} 'b' 'int' } namespace NS { struct X {}; void f(X); void y(...); } // namespace NS // CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}ADLCall 'void ()' void ADLCall() { NS::X x; // CHECK: CallExpr 0x{{[^ ]*}} ]+}}> 'void' adl{{$}} f(x); // CHECK: CallExpr 0x{{[^ ]*}} ]+}}> 'void' adl{{$}} y(x); } // CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}NonADLCall 'void ()' void NonADLCall() { NS::X x; // CHECK: CallExpr 0x{{[^ ]*}} ]+}}> 'void'{{$}} NS::f(x); } // CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}NonADLCall2 'void ()' void NonADLCall2() { NS::X x; using NS::f; // CHECK: CallExpr 0x{{[^ ]*}} ]+}}> 'void'{{$}} f(x); // CHECK: CallExpr 0x{{[^ ]*}} ]+}}> 'void' adl{{$}} y(x); } namespace test_adl_call_three { using namespace NS; // CHECK-LABEL: FunctionDecl 0x{{[^ ]*}} {{.*}}NonADLCall3 'void ()' void NonADLCall3() { X x; // CHECK: CallExpr 0x{{[^ ]*}} ]+}}> 'void'{{$}} f(x); } } // namespace test_adl_call_three