llvm.org GIT mirror llvm / a2da788
Fix infinite loop in nested multiclasses. Patch by Michael Liao! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152232 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 7 years ago
2 changed file(s) with 48 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
17251725 } // Otherwise this isn't yet registered.
17261726 Name = NewName;
17271727 checkName();
1728 // Since the Init for the name was changed, see if we can resolve
1729 // any of it using members of the Record.
1730 Init *ComputedName = Name->resolveReferences(*this, 0);
1731 if (ComputedName != Name) {
1732 setName(ComputedName);
1733 }
17341728 // DO NOT resolve record values to the name at this point because
17351729 // there might be default values for arguments of this def. Those
17361730 // arguments might not have been resolved yet so we don't want to
17531747 /// references.
17541748 void Record::resolveReferencesTo(const RecordVal *RV) {
17551749 for (unsigned i = 0, e = Values.size(); i != e; ++i) {
1750 if (RV == &Values[i]) // Skip resolve the same field as the given one
1751 continue;
17561752 if (Init *V = Values[i].getValue())
17571753 Values[i].setValue(V->resolveReferences(*this, RV));
17581754 }
0 // RUN: llvm-tblgen %s | FileCheck %s
1 // XFAIL: vg_leak
2
3 class Type {
4 string Name = name;
5 int Length = length;
6 int Width = width;
7 }
8
9 multiclass OT1 {
10 def _#NAME# : Type;
11 }
12 multiclass OT2 {
13 defm v1#NAME# : OT1;
14 defm v2#NAME# : OT1;
15 defm v3#NAME# : OT1;
16 defm v4#NAME# : OT1;
17 defm v8#NAME# : OT1;
18 defm v16#NAME# : OT1;
19 }
20
21 defm i8 : OT2<"i8", 8>;
22
23 // CHECK: _v16i8
24 // CHECK: Length = 16
25 // CHECK: Width = 8
26
27 // CHECK: _v1i8
28 // CHECK: Length = 1
29 // CHECK: Width = 8
30
31 // CHECK: _v2i8
32 // CHECK: Length = 2
33 // CHECK: Width = 8
34
35 // CHECK: _v3i8
36 // CHECK: Length = 3
37 // CHECK: Width = 8
38
39 // CHECK: _v4i8
40 // CHECK: Length = 4
41 // CHECK: Width = 8
42
43 // CHECK: _v8i8
44 // CHECK: Length = 8
45 // CHECK: Width = 8