1 // RUN: llvm-tblgen %s | FileCheck %s
2 // RUN: not llvm-tblgen -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
3 // RUN: not llvm-tblgen -DERROR2 %s 2>&1 | FileCheck --check-prefix=ERROR2 %s
12 // Test inside a foreach, with condition based on the iteration variable.
14 // CHECK: def bNotThree1
15 // CHECK: def bNotThree2
16 // CHECK: def bNotThree4
18 foreach i = 1...4 in {
26 // Test inside a multiclass, with condition based on a multiclass parameter.
28 multiclass Multi<int i> {
40 // CHECK-NOT: def c1Cond
41 // CHECK: def c1ElseRec
42 // CHECK-NOT: def c1ThenRec
43 // CHECK: def c1Unconditional
47 // CHECK: def c2ElseRec
48 // CHECK-NOT: def c2ThenRec
49 // CHECK: def c2Unconditional
52 // CHECK-NOT: def c3Cond
53 // CHECK-NOT: def c3ElseRec
54 // CHECK: def c3ThenRec
55 // CHECK: def c3Unconditional
58 // Test resolution of the dangling-else ambiguity.
60 // CHECK: def dThenElse00
61 // CHECK-NOT: def dThenElse1
62 // CHECK-NOT: def dThenElse11
63 // CHECK: def dThenThen01
69 else // binds to the inner if, not the outer one
72 // Error tests: ensure you can't put an if inside a def or class.
77 // ERROR1: [[@LINE+1]]:3: error: Unknown token when expecting a type
85 class badclass<int i> {
87 // ERROR2: [[@LINE+1]]:3: error: Unknown token when expecting a type