Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenCXX/delete-two-arg.cpp
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

68 lines
2.1 KiB
C++

// RUN: %clang_cc1 -triple i686-pc-linux-gnu %s -o - -emit-llvm -verify | FileCheck %s
// expected-no-diagnostics
typedef __typeof(sizeof(int)) size_t;
namespace test1 {
struct A { void operator delete(void*,size_t); int x; };
// CHECK-LABEL: define{{.*}} void @_ZN5test11aEPNS_1AE(
void a(A *x) {
// CHECK: load
// CHECK-NEXT: icmp eq {{.*}}, null
// CHECK-NEXT: br i1
// CHECK: call void @_ZN5test11AdlEPvj(ptr noundef %{{.*}}, i32 noundef 4)
delete x;
}
}
// Check that we make cookies for the two-arg delete even when using
// the global allocator and deallocator.
namespace test2 {
struct A {
int x;
void *operator new[](size_t);
void operator delete[](void *, size_t);
};
// CHECK: define{{.*}} ptr @_ZN5test24testEv()
A *test() {
// CHECK: [[NEW:%.*]] = call noalias noundef nonnull ptr @_Znaj(i32 noundef 44)
// CHECK-NEXT: store i32 10, ptr [[NEW]]
// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i8, ptr [[NEW]], i32 4
// CHECK-NEXT: ret ptr [[T1]]
return ::new A[10];
}
// CHECK-LABEL: define{{.*}} void @_ZN5test24testEPNS_1AE(
void test(A *p) {
// CHECK: [[P:%.*]] = alloca ptr, align 4
// CHECK-NEXT: store ptr {{%.*}}, ptr [[P]], align 4
// CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[P]], align 4
// CHECK-NEXT: [[T1:%.*]] = icmp eq ptr [[T0]], null
// CHECK-NEXT: br i1 [[T1]],
// CHECK: [[T3:%.*]] = getelementptr inbounds i8, ptr [[T0]], i32 -4
// CHECK-NEXT: [[T5:%.*]] = load i32, ptr [[T3]]
// CHECK-NEXT: [[T6:%.*]] = mul i32 4, [[T5]]
// CHECK-NEXT: [[T7:%.*]] = add i32 [[T6]], 4
// CHECK-NEXT: call void @_ZdaPvj(ptr noundef [[T3]], i32 noundef [[T7]])
// CHECK-NEXT: br label
::delete[] p;
}
}
namespace test3 {
struct A {
int x;
void operator delete[](void *, size_t);
};
struct B : A {};
// CHECK-LABEL: define{{.*}} void @_ZN5test34testEv()
void test() {
// CHECK: [[CALL:%.*]] = call noalias noundef nonnull ptr @_Znaj(i32 noundef 24)
// CHECK-NEXT: store i32 5
(void) new B[5];
}
}