Files
RedBear-OS/local/recipes/dev/libclc/source/llvm/test/TableGen/interleave.td
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

99 lines
2.7 KiB
TableGen

// RUN: llvm-tblgen %s | FileCheck %s
// RUN: not llvm-tblgen -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
defvar EmptyList = []<string>;
defvar OneList = ["hello"];
defvar StringList = ["foo", "bar", "zoo", "snork", "quux"];
defvar IntList = [0, 1, 2, 3, 4, 5, 6, 7];
defvar BitsList = [ {0, 1, 0}, {1, 1, 1}, {0, 0, 1} ];
defvar BitList = [0, 1, 1, 0, 1]<bit>;
class Ishify<list<string> words> {
list<string> ret = !foreach(w, words, w # "ify");
}
// CHECK: def Rec1
// CHECK: Test1 = "";
// CHECK: Test2 = "hello";
// CHECK: Test3 = "foobarzoosnorkquux";
// CHECK: Test4 = "foo, bar, zoo, snork, quux";
// CHECK: Test5 = "foo & bar & zoo & snork & quux & grits";
def Rec1 {
string Test1 = !interleave(EmptyList, "/");
string Test2 = !interleave(OneList, ":");
string Test3 = !interleave(StringList, "");
string Test4 = !interleave(StringList, ", ");
string Test5 = !interleave(!listconcat(StringList, ["grits"]), " & ");
}
// CHECK: def Rec2
// CHECK: Test1 = "01234567";
// CHECK: Test2 = "0, 1, 2, 3, 4, 5, 6, 7";
// CHECK: Test3 = "0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 42";
def Rec2 {
string Test1 = !interleave(IntList, "");
string Test2 = !interleave(IntList, ", ");
string Test3 = !interleave(!listconcat(IntList, [42]), " & ");
}
// CHECK: def Rec3
// CHECK: Test1 = "271";
// CHECK: Test2 = "2, 7, 1";
// CHECK: Test3 = "2 & 7 & 1 & 0";
def Rec3 {
string Test1 = !interleave(BitsList, "");
string Test2 = !interleave(BitsList, ", ");
string Test3 = !interleave(!listconcat(BitsList, [ {0, 0, 0} ]), " & ");
}
// CHECK: def Rec4
// CHECK: Test1 = "01101";
// CHECK: Test2 = "0, 1, 1, 0, 1";
// CHECK: Test3 = "0 and 1 and 1 and 0 and 1 and 1";
def Rec4 {
string Test1 = !interleave(BitList, "");
string Test2 = !interleave(BitList, ", ");
string Test3 = !interleave(!listconcat(BitList, [1]), " and ");
}
// CHECK: def Rec5
// CHECK: Colors = ["red", "green", "yellow"];
// CHECK: ColorList = "redify, greenify, yellowify";
def Rec5 {
list<string> Colors = ["red", "green", "yellow"];
string ColorList = !interleave(Ishify<Colors>.ret, ", ");
}
// CHECK: def Rec6
// CHECK: code OperatorList = [{+, -, *, /, ?:, ;}];
def Rec6 {
list<string> Operators = ["+", "-", "*", "/", "?:"];
code OperatorList = !interleave(!listconcat(Operators, [[{;}]]), ", ");
}
// CHECK: def Rec7
// CHECK: str = "foo/bar/zoo";
def Rec7 {
string foo = "foo";
string zoo = "oops, not zoo";
string str = !interleave([foo, "bar", zoo], "/");
let zoo = "zoo";
}
#ifdef ERROR1
def op;
// ERROR1: expected list of string, int, bits, or bit; got value of type
def Rec6 {
string Bad = !interleave([(op), (op "hello")], " = ");
}
#endif