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

60 lines
1.2 KiB
TableGen

// RUN: llvm-tblgen %s | FileCheck %s
// RUN: not llvm-tblgen -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
// This file tests the !cast bang operator with the result type string.
defvar IntList = [0, 1, 2, 3, 4, 5, 6];
// CHECK: def Rec0
// CHECK: string str3 = "a string here"
def Rec0 {
string str = "a string";
string str2 = !cast<string>(str);
string str3 = !cast<string>(str # " here");
}
// CHECK: def Rec1
// CHECK: string str = "42 -108"
def Rec1 {
int int1 = 42;
int int2 = -108;
string str = !cast<string>(int1) # " " # !cast<string>(int2);
}
// CHECK: def Rec2
// CHECK: string str = "0, 1"
def Rec2 {
bit bit1 = false;
bit bit2 = true;
string str = !cast<string>(bit1) # ", " # !cast<string>(bit2);
}
// CHECK: def Rec3
// CHECK: string str = "5 and 37"
def Rec3 {
bits<4> bits1 = 0b0101;
bits<8> bits2 = 0b00100101;
string str = !cast<string>(bits1) # " and " # !cast<string>(bits2);
}
// CHECK: def Rec4
// CHECK: string str = "Rec1, Rec2"
def Rec4 {
string str = !cast<string>(Rec1) # ", " # !cast<string>(Rec2);
}
#ifdef ERROR1
// ERROR1: nitializer of 'str' in 'Rec5' could not be fully resolved
def Rec5 {
string str = !cast<string>(IntList);
}
#endif