Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

82 lines
2.2 KiB
TableGen

// RUN: llvm-tblgen %s | FileCheck %s
// RUN: not llvm-tblgen -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
defvar claim = "This is the end of the world!";
// CHECK: def Rec1
// CHECK: fullNoLength = "This is the end of the world!";
// CHECK: fullLength = "This is the end of the world!";
// CHECK: thisIsTheEnd = "This is the end";
// CHECK: DoorsSong = "the end";
// CHECK: finalNoLength = "end of the world!";
// CHECK: finalLength = "end of the world!";
def Rec1 {
string fullNoLength = !substr(claim, 0);
string fullLength = !substr(claim, 0, 999);
string thisIsTheEnd = !substr(claim, 0, 15);
string DoorsSong = !substr(claim, 8, 7);
string finalNoLength = !substr(claim, 12);
string finalLength = !substr(claim, 12, !sub(!size(claim), 12));
}
// CHECK: def Rec2 {
// CHECK: lastName = "Flintstone";
def Rec2 {
string firstName = "Fred";
string name = firstName # " " # "Flintstone";
string lastName = !substr(name, !add(!size(firstName), 1));
}
// CHECK: def Rec3 {
// CHECK: test1 = "";
// CHECK: test2 = "";
// CHECK: test3 = "";
// CHECK: test4 = "h";
// CHECK: test5 = "hello";
// CHECK: test6 = "";
def Rec3 {
string test1 = !substr("", 0, 0);
string test2 = !substr("", 0, 9);
string test3 = !substr("hello", 0, 0);
string test4 = !substr("hello", 0, 1);
string test5 = !substr("hello", 0, 99);
string test6 = !substr("hello", 5, 99);
}
// CHECK: def Rec4
// CHECK: message = "This is the end of the world!";
// CHECK: messagePrefix = "This is th...";
// CHECK: warning = "Bad message: 'This is th...'";
class C<string msg> {
string message = msg;
string messagePrefix = !substr(message, 0, 10) # "...";
}
def Rec4 : C<claim> {
string warning = "Bad message: '" # messagePrefix # "'";
}
#ifdef ERROR1
// ERROR1: expected string, got type 'int'
// ERROR1: expected int, got type 'bits<3>'
// ERROR1: expected int, got type 'string'
// ERROR1: !substr start position is out of range 0...29: 30
// ERROR1: !substr length must be nonnegative
def Rec8 {
string claim1 = !substr(42, 0, 3);
string claim2 = !substr(claim, 0b101);
string claim3 = !substr(claim, 0, "oops");
}
def Rec9 {
string claim1 = !substr(claim, !add(!size(claim), 1));
string claim2 = !substr(claim, 0, -13);
}
#endif