Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenCXX/assign-construct-memcpy.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

90 lines
2.7 KiB
C++

/// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - -std=c++11 %s -DPOD | FileCheck %s -check-prefix=CHECK-POD
// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -emit-llvm -o - -std=c++11 %s | FileCheck %s -check-prefix=CHECK-NONPOD
// Declare the reserved placement operators.
typedef __typeof__(sizeof(0)) size_t;
void *operator new(size_t, void*) throw();
void operator delete(void*, void*) throw();
void *operator new[](size_t, void*) throw();
void operator delete[](void*, void*) throw();
template<typename T> T &&move(T&);
struct foo {
#ifndef POD
foo() {} // non-POD
#endif
void *a, *b;
bool c;
};
// It is not legal to copy the tail padding in all cases, but if it is it can
// yield better codegen.
foo *test1(void *f, const foo &x) {
return new (f) foo(x);
// CHECK-POD: test1
// CHECK-POD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
// CHECK-NONPOD: test1
// CHECK-NONPOD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
}
foo *test2(const foo &x) {
return new foo(x);
// CHECK-POD: test2
// CHECK-POD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 16 {{.*}} align 8 {{.*}}i64 24
// CHECK-NONPOD: test2
// CHECK-NONPOD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 16 {{.*}} align 8 {{.*}}i64 24
}
foo test3(const foo &x) {
foo f = x;
return f;
// CHECK-POD: test3
// CHECK-POD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
// CHECK-NONPOD: test3
// CHECK-NONPOD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
}
foo *test4(foo &&x) {
return new foo(x);
// CHECK-POD: test4
// CHECK-POD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 16 {{.*}} align 8 {{.*}}i64 24
// CHECK-NONPOD: test4
// CHECK-NONPOD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 16 {{.*}} align 8 {{.*}}i64 24
}
void test5(foo &f, const foo &x) {
f = x;
// CHECK-POD: test5
// CHECK-POD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
// CHECK-NONPOD: test5
// CHECK-NONPOD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 17
}
extern foo globtest;
void test6(foo &&x) {
globtest = move(x);
// CHECK-POD: test6
// CHECK-POD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
// CHECK-NONPOD: test6
// CHECK-NONPOD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 17
}
void byval(foo f);
void test7(const foo &x) {
byval(x);
// CHECK-POD: test7
// CHECK-POD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
// CHECK-NONPOD: test7
// CHECK-NONPOD: call void @llvm.memcpy.p0.p0.i64({{.*}} align 8 {{.*}} align 8 {{.*}}i64 24
}