cb424d7448
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).
141 lines
2.6 KiB
C++
141 lines
2.6 KiB
C++
// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s
|
|
|
|
struct ThisShouldBeCalled {
|
|
ThisShouldBeCalled() {}
|
|
};
|
|
|
|
template <typename T>
|
|
struct ThisShouldBeCalledTPL {
|
|
ThisShouldBeCalledTPL() {}
|
|
};
|
|
|
|
consteval int f () {
|
|
return 42;
|
|
}
|
|
|
|
struct WithConsteval {
|
|
WithConsteval(int x = f()) {}
|
|
};
|
|
|
|
template <typename T>
|
|
struct WithConstevalTPL {
|
|
WithConstevalTPL(T x = f()) {}
|
|
};
|
|
|
|
|
|
struct Base {
|
|
ThisShouldBeCalled y = {};
|
|
};
|
|
|
|
struct S : Base {
|
|
ThisShouldBeCalledTPL<int> A = {};
|
|
WithConsteval B = {};
|
|
WithConstevalTPL<double> C = {};
|
|
};
|
|
void Do(S = S{}) {}
|
|
|
|
void test() {
|
|
Do();
|
|
}
|
|
|
|
// CHECK-LABEL: @_ZN18ThisShouldBeCalledC2Ev
|
|
// CHECK-LABEL: @_ZN21ThisShouldBeCalledTPLIiEC2Ev
|
|
// CHECK-LABEL: @_ZN13WithConstevalC2Ei
|
|
// CHECK-LABEL: @_ZN16WithConstevalTPLIdEC2Ed
|
|
|
|
namespace check_arrays {
|
|
|
|
template <typename T>
|
|
struct inner {
|
|
inner() {}
|
|
};
|
|
|
|
struct S {
|
|
inner<int> a {};
|
|
};
|
|
|
|
class C {
|
|
S s[1]{};
|
|
};
|
|
|
|
int f() {
|
|
C c;
|
|
return 0;
|
|
}
|
|
|
|
// CHECK-LABEL: @_ZN12check_arrays5innerIiEC2Ev
|
|
|
|
}
|
|
|
|
namespace check_field_inits_in_base_constructors {
|
|
|
|
template <typename>
|
|
struct ShouldBeODRUsed {
|
|
ShouldBeODRUsed() {}
|
|
};
|
|
class k {
|
|
// The private here is important,
|
|
// otherwise it would be aggregate initialized.
|
|
private:
|
|
ShouldBeODRUsed<k> a = {};
|
|
};
|
|
|
|
struct b {
|
|
k c{};
|
|
};
|
|
void test() { b d; }
|
|
|
|
// CHECK-LABEL: @_ZN38check_field_inits_in_base_constructors15ShouldBeODRUsedINS_1kEEC2Ev
|
|
|
|
}
|
|
|
|
namespace check_referenced_when_defined_in_default_parameter {
|
|
|
|
template <typename T>
|
|
struct Test {
|
|
Test(auto&&) {}
|
|
};
|
|
|
|
struct Options {
|
|
Test<bool(bool x)> identity = [](bool x) -> bool { return x; };
|
|
};
|
|
|
|
struct Wrapper {
|
|
Wrapper(const Options& options = Options());
|
|
};
|
|
|
|
void Func() { Options options; }
|
|
|
|
// CHECK-LABEL: @_ZN50check_referenced_when_defined_in_default_parameter7OptionsC2Ev
|
|
// CHECK-LABEL: @_ZN50check_referenced_when_defined_in_default_parameter4TestIFbbEEC1INS_7Options8identityMUlbE_EEEOT_
|
|
// CHECK-LABEL: @_ZN50check_referenced_when_defined_in_default_parameter4TestIFbbEEC2INS_7Options8identityMUlbE_EEEOT_
|
|
|
|
}
|
|
|
|
namespace lambda_body {
|
|
template <typename a>
|
|
int templated_func() {
|
|
return 0;
|
|
}
|
|
struct test_body {
|
|
int mem = templated_func<int>();
|
|
};
|
|
struct test_capture {
|
|
int mem = templated_func<double>();
|
|
};
|
|
|
|
struct S {
|
|
int a = [_ = test_capture{}] { (void)test_body{}; return 0;}();
|
|
};
|
|
|
|
void test() {
|
|
S s;
|
|
}
|
|
|
|
// CHECK-LABEL: define{{.*}} @_ZN11lambda_body14templated_funcIdEEiv
|
|
// CHECK-LABEL: define{{.*}} @_ZNK11lambda_body1S1aMUlvE_clEv
|
|
// CHECK-LABEL: define{{.*}} @_ZN11lambda_body14templated_funcIiEEiv
|
|
|
|
|
|
}
|