diff options
Diffstat (limited to 'test/CodeGenCXX/catch-undef-behavior.cpp')
-rw-r--r-- | test/CodeGenCXX/catch-undef-behavior.cpp | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/test/CodeGenCXX/catch-undef-behavior.cpp b/test/CodeGenCXX/catch-undef-behavior.cpp index 4513936e49a30..0e8d4fa51a0c0 100644 --- a/test/CodeGenCXX/catch-undef-behavior.cpp +++ b/test/CodeGenCXX/catch-undef-behavior.cpp @@ -72,7 +72,7 @@ void member_access(S *p) { // The two hash values are for 64- and 32-bit Clang binaries, respectively. // FIXME: We should produce a 64-bit value either way. // - // CHECK-NEXT: xor i64 {{-4030275160588942838|2562089159}}, %[[VPTR]] + // CHECK-NEXT: xor i64 {{-4030275160588942838|1107558922}}, %[[VPTR]] // CHECK-NEXT: mul i64 {{.*}}, -7070675565921424023 // CHECK-NEXT: lshr i64 {{.*}}, 47 // CHECK-NEXT: xor i64 @@ -121,7 +121,7 @@ void member_access(S *p) { // (3b) Check that 'p' actually points to an 'S' // CHECK: load i64, i64* - // CHECK-NEXT: xor i64 {{-4030275160588942838|2562089159}}, + // CHECK-NEXT: xor i64 {{-4030275160588942838|1107558922}}, // [...] // CHECK: getelementptr inbounds [128 x i64], [128 x i64]* @__ubsan_vptr_type_cache, i32 0, i64 % // CHECK: br i1 @@ -520,6 +520,49 @@ void upcast_to_vbase() { } } +struct nothrow {}; +void *operator new[](__SIZE_TYPE__, nothrow) noexcept; + +namespace NothrowNew { + struct X { X(); }; + + // CHECK-LABEL: define{{.*}}nothrow_new_trivial + void *nothrow_new_trivial() { + // CHECK: %[[is_null:.*]] = icmp eq i8*{{.*}}, null + // CHECK: br i1 %[[is_null]], label %[[null:.*]], label %[[nonnull:.*]] + + // CHECK: [[nonnull]]: + // CHECK: llvm.objectsize + // CHECK: br i1 + // + // CHECK: call {{.*}}__ubsan_handle_type_mismatch + // + // CHECK: [[null]]: + // CHECK-NOT: {{ }}br{{ }} + // CHECK: ret + return new (nothrow{}) char[123456]; + } + + // CHECK-LABEL: define{{.*}}nothrow_new_nontrivial + void *nothrow_new_nontrivial() { + // CHECK: %[[is_null:.*]] = icmp eq i8*{{.*}}, null + // CHECK: br i1 %[[is_null]], label %[[null:.*]], label %[[nonnull:.*]] + + // CHECK: [[nonnull]]: + // CHECK: llvm.objectsize + // CHECK: br i1 + // + // CHECK: call {{.*}}__ubsan_handle_type_mismatch + // + // CHECK: call {{.*}}_ZN10NothrowNew1XC1Ev + // + // CHECK: [[null]]: + // CHECK-NOT: {{ }}br{{ }} + // CHECK: ret + return new (nothrow{}) X[123456]; + } +} + struct ThisAlign { void this_align_lambda(); void this_align_lambda_2(); |