2010-11-22 18:30:56 +08:00
|
|
|
// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
class P {
|
|
|
|
public:
|
|
|
|
P(T* t) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace foo {
|
2015-09-04 18:17:10 +08:00
|
|
|
class A { public: A(int = 0) {} };
|
2010-11-22 18:30:56 +08:00
|
|
|
enum B {};
|
|
|
|
typedef int C;
|
|
|
|
}
|
|
|
|
|
2014-04-02 13:48:29 +08:00
|
|
|
// CHECK: VarDecl {{0x[0-9a-fA-F]+}} <line:16:1, col:36> col:15 ImplicitConstrArray 'foo::A [2]'
|
2013-01-23 01:00:09 +08:00
|
|
|
static foo::A ImplicitConstrArray[2];
|
|
|
|
|
2010-11-22 18:30:56 +08:00
|
|
|
int main() {
|
2011-03-17 04:16:18 +08:00
|
|
|
// CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::A *'
|
2010-11-22 18:30:56 +08:00
|
|
|
P<foo::A> p14 = new foo::A;
|
2011-03-17 04:16:18 +08:00
|
|
|
// CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::B *'
|
2010-11-22 18:30:56 +08:00
|
|
|
P<foo::B> p24 = new foo::B;
|
|
|
|
// CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::C *'
|
|
|
|
P<foo::C> pr4 = new foo::C;
|
|
|
|
}
|
2010-11-22 21:12:28 +08:00
|
|
|
|
|
|
|
foo::A getName() {
|
2011-03-17 04:16:18 +08:00
|
|
|
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:10, col:17> 'foo::A'
|
2010-11-22 21:12:28 +08:00
|
|
|
return foo::A();
|
|
|
|
}
|
2014-01-22 08:30:17 +08:00
|
|
|
|
|
|
|
void destruct(foo::A *a1, foo::A *a2, P<int> *p1) {
|
|
|
|
// CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:8> '<bound member function type>' ->~A
|
|
|
|
a1->~A();
|
|
|
|
// CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:16> '<bound member function type>' ->~A
|
|
|
|
a2->foo::A::~A();
|
|
|
|
// CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:13> '<bound member function type>' ->~P
|
|
|
|
p1->~P<int>();
|
2014-04-02 13:48:29 +08:00
|
|
|
}
|
2015-09-04 18:17:10 +08:00
|
|
|
|
|
|
|
struct D {
|
|
|
|
D(int);
|
|
|
|
~D();
|
|
|
|
};
|
|
|
|
|
|
|
|
void construct() {
|
|
|
|
using namespace foo;
|
|
|
|
A a = A(12);
|
2015-09-04 19:40:31 +08:00
|
|
|
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'class foo::A' 'void (int){{ __attribute__\(\(thiscall\)\)?}}'
|
2015-09-04 18:17:10 +08:00
|
|
|
D d = D(12);
|
2015-09-04 19:40:31 +08:00
|
|
|
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'struct D' 'void (int){{ __attribute__\(\(thiscall\)\)?}}'
|
2015-09-04 18:17:10 +08:00
|
|
|
}
|