Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/test/CodeGenCXX/new.cpp
Show All 9 Lines | |||||
void *operator new[](size_t); | void *operator new[](size_t); | ||||
void t1() { | void t1() { | ||||
delete new int; | delete new int; | ||||
delete [] new int [3]; | delete [] new int [3]; | ||||
} | } | ||||
// CHECK: declare noundef nonnull i8* @_Znwm(i64 noundef) [[ATTR_NOBUILTIN:#[^ ]*]] | // CHECK: declare noundef nonnull i8* @_Znwm(i64 noundef) [[ATTR_NOBUILTIN:#[^ ]*]] | ||||
// CHECK: declare void @_ZdlPv(i8* noundef) [[ATTR_NOBUILTIN_NOUNWIND:#[^ ]*]] | // CHECK: declare void @_ZdlPvm(i8* noundef, i64 noundef) [[ATTR_NOBUILTIN_NOUNWIND:#[^ ]*]] | ||||
// CHECK: declare noundef nonnull i8* @_Znam(i64 noundef) [[ATTR_NOBUILTIN]] | // CHECK: declare noundef nonnull i8* @_Znam(i64 noundef) [[ATTR_NOBUILTIN]] | ||||
// CHECK: declare void @_ZdaPv(i8* noundef) [[ATTR_NOBUILTIN_NOUNWIND]] | // CHECK: declare void @_ZdaPv(i8* noundef) [[ATTR_NOBUILTIN_NOUNWIND]] | ||||
namespace std { | namespace std { | ||||
struct nothrow_t {}; | struct nothrow_t {}; | ||||
} | } | ||||
std::nothrow_t nothrow; | std::nothrow_t nothrow; | ||||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | void f() { | ||||
// CHECK: call void @_ZN5AllocD1Ev( | // CHECK: call void @_ZN5AllocD1Ev( | ||||
// CHECK: call void @_ZN5AllocdaEPv(i8* | // CHECK: call void @_ZN5AllocdaEPv(i8* | ||||
delete[] new Alloc[10][20]; | delete[] new Alloc[10][20]; | ||||
// CHECK: [[P:%.*]] = call noundef nonnull i8* @_ZN5AllocnaEmRKSt9nothrow_t(i64 noundef 808, {{.*}}) [[ATTR_NOUNWIND:#[^ ]*]] | // CHECK: [[P:%.*]] = call noundef nonnull i8* @_ZN5AllocnaEmRKSt9nothrow_t(i64 noundef 808, {{.*}}) [[ATTR_NOUNWIND:#[^ ]*]] | ||||
// CHECK-NOT: icmp eq i8* [[P]], null | // CHECK-NOT: icmp eq i8* [[P]], null | ||||
// CHECK: store i64 200 | // CHECK: store i64 200 | ||||
delete[] new (nothrow) Alloc[10][20]; | delete[] new (nothrow) Alloc[10][20]; | ||||
// CHECK: call noalias noundef nonnull i8* @_Znwm | // CHECK: call noalias noundef nonnull i8* @_Znwm | ||||
// CHECK: call void @_ZdlPv(i8* | // CHECK: call void @_ZdlPvm(i8* noundef {{%.*}}, i64 noundef 1) | ||||
delete new bool; | delete new bool; | ||||
// CHECK: ret void | // CHECK: ret void | ||||
} | } | ||||
namespace test15 { | namespace test15 { | ||||
struct A { A(); ~A(); }; | struct A { A(); ~A(); }; | ||||
// CHECK-LABEL: define{{.*}} void @_ZN6test156test0aEPv( | // CHECK-LABEL: define{{.*}} void @_ZN6test156test0aEPv( | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | |||||
namespace N3664 { | namespace N3664 { | ||||
struct S { S() throw(int); }; | struct S { S() throw(int); }; | ||||
// CHECK-LABEL: define{{.*}} void @_ZN5N36641fEv | // CHECK-LABEL: define{{.*}} void @_ZN5N36641fEv | ||||
void f() { | void f() { | ||||
// CHECK: call noalias noundef nonnull i8* @_Znwm(i64 noundef 4) [[ATTR_BUILTIN_NEW:#[^ ]*]] | // CHECK: call noalias noundef nonnull i8* @_Znwm(i64 noundef 4) [[ATTR_BUILTIN_NEW:#[^ ]*]] | ||||
int *p = new int; // expected-note {{allocated with 'new' here}} | int *p = new int; // expected-note {{allocated with 'new' here}} | ||||
// CHECK: call void @_ZdlPv({{.*}}) [[ATTR_BUILTIN_DELETE:#[^ ]*]] | // CHECK: call void @_ZdlPvm({{.*}}) [[ATTR_BUILTIN_DELETE:#[^ ]*]] | ||||
delete p; | delete p; | ||||
// CHECK: call noalias noundef nonnull i8* @_Znam(i64 noundef 12) [[ATTR_BUILTIN_NEW]] | // CHECK: call noalias noundef nonnull i8* @_Znam(i64 noundef 12) [[ATTR_BUILTIN_NEW]] | ||||
int *q = new int[3]; | int *q = new int[3]; | ||||
// CHECK: call void @_ZdaPv({{.*}}) [[ATTR_BUILTIN_DELETE]] | // CHECK: call void @_ZdaPv({{.*}}) [[ATTR_BUILTIN_DELETE]] | ||||
delete[] p; // expected-warning {{'delete[]' applied to a pointer that was allocated with 'new'; did you mean 'delete'?}} | delete[] p; // expected-warning {{'delete[]' applied to a pointer that was allocated with 'new'; did you mean 'delete'?}} | ||||
// CHECK: call noalias noundef i8* @_ZnamRKSt9nothrow_t(i64 noundef 3, {{.*}}) [[ATTR_NOBUILTIN_NOUNWIND_ALLOCSIZE:#[^ ]*]] | // CHECK: call noalias noundef i8* @_ZnamRKSt9nothrow_t(i64 noundef 3, {{.*}}) [[ATTR_NOBUILTIN_NOUNWIND_ALLOCSIZE:#[^ ]*]] | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |