Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenCXX/cxx0x-initializer-array.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

113 lines
2.4 KiB
C++

// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -emit-llvm -o - %s -Wno-address-of-temporary | FileCheck %s
// CHECK: @[[THREE_NULL_MEMPTRS:.*]] = private constant [3 x i32] [i32 -1, i32 -1, i32 -1]
struct A { int a[1]; };
typedef A x[];
int f() {
x{{{1}}};
// CHECK-LABEL: define{{.*}} i32 @_Z1fv
// CHECK: store i32 1
// (It's okay if the output changes here, as long as we don't crash.)
return 0;
}
namespace ValueInitArrayOfMemPtr {
struct S {};
typedef int (S::*p);
typedef p a[3];
void f(const a &);
struct Agg1 {
int n;
p x;
};
struct Agg2 {
int n;
a x;
};
struct S1 {
p x;
S1();
};
// CHECK-LABEL: define{{.*}} void @_ZN22ValueInitArrayOfMemPtr1fEi
void f(int n) {
Agg1 a = { n };
// CHECK: store i32 -1,
Agg2 b = { n };
// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %{{.*}}, ptr align 4 @[[THREE_NULL_MEMPTRS]], i32 12, i1 false)
}
// Test dynamic initialization.
// CHECK-LABEL: define{{.*}} void @_ZN22ValueInitArrayOfMemPtr1gEMNS_1SEi
void g(p ptr) {
// CHECK: store i32 -1,
f(a{ptr});
}
}
namespace array_dtor {
struct S { S(); ~S(); };
using T = S[3];
void f(const T &);
void f(T *);
// CHECK-LABEL: define{{.*}} void @_ZN10array_dtor1gEv(
void g() {
// CHECK: %[[ARRAY:.*]] = alloca [3 x
// CHECK: br
// Construct loop.
// CHECK: call void @_ZN10array_dtor1SC1Ev(
// CHECK: br i1
// CHECK: call void @_ZN10array_dtor1fERA3_KNS_1SE(
// CHECK: br
// Destruct loop.
// CHECK: call void @_ZN10array_dtor1SD1Ev(
// CHECK: br i1
f(T{});
// CHECK: ret void
}
// CHECK-LABEL: define{{.*}} void @_ZN10array_dtor1hEv(
void h() {
// CHECK: %[[ARRAY:.*]] = alloca [3 x
// CHECK: br
// CHECK: call void @_ZN10array_dtor1SC1Ev(
// CHECK: br i1
T &&t = T{};
// CHECK: call void @_ZN10array_dtor1fERA3_KNS_1SE(
// CHECK: br
f(t);
// CHECK: call void @_ZN10array_dtor1SD1Ev(
// CHECK: br i1
// CHECK: ret void
}
// CHECK-LABEL: define{{.*}} void @_ZN10array_dtor1iEv(
void i() {
// CHECK: %[[ARRAY:.*]] = alloca [3 x
// CHECK: br
// CHECK: call void @_ZN10array_dtor1SC1Ev(
// CHECK: br i1
// CHECK: call void @_ZN10array_dtor1fEPA3_NS_1SE(
// CHECK: br
// CHECK: call void @_ZN10array_dtor1SD1Ev(
// CHECK: br i1
f(&T{});
// CHECK: ret void
}
}