1// RUN: llvm-tblgen %s | FileCheck %s 2// RUN: not llvm-tblgen -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s 3 4// This file tests the !cast bang operator with the result type string. 5 6defvar IntList = [0, 1, 2, 3, 4, 5, 6]; 7 8// CHECK: def Rec0 9// CHECK: string str3 = "a string here" 10 11def Rec0 { 12 string str = "a string"; 13 string str2 = !cast<string>(str); 14 string str3 = !cast<string>(str # " here"); 15} 16 17// CHECK: def Rec1 18// CHECK: string str = "42 -108" 19 20def Rec1 { 21 int int1 = 42; 22 int int2 = -108; 23 string str = !cast<string>(int1) # " " # !cast<string>(int2); 24} 25 26// CHECK: def Rec2 27// CHECK: string str = "0, 1" 28 29def Rec2 { 30 bit bit1 = false; 31 bit bit2 = true; 32 string str = !cast<string>(bit1) # ", " # !cast<string>(bit2); 33} 34 35// CHECK: def Rec3 36// CHECK: string str = "5 and 37" 37 38def Rec3 { 39 bits<4> bits1 = 0b0101; 40 bits<8> bits2 = 0b00100101; 41 string str = !cast<string>(bits1) # " and " # !cast<string>(bits2); 42} 43 44// CHECK: def Rec4 45// CHECK: string str = "Rec1, Rec2" 46 47def Rec4 { 48 string str = !cast<string>(Rec1) # ", " # !cast<string>(Rec2); 49} 50 51#ifdef ERROR1 52 53// ERROR1: nitializer of 'str' in 'Rec5' could not be fully resolved 54 55def Rec5 { 56 string str = !cast<string>(IntList); 57} 58 59#endif 60