mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[TableGen] fix assert in !cast when used out of definition in a multiclass
Differential Revision: https://reviews.llvm.org/D53068 llvm-svn: 344134
This commit is contained in:
parent
ac55dda5e5
commit
e0c17ed278
@ -709,6 +709,8 @@ Init *UnOpInit::Fold(Record *CurRec, bool IsFinal) const {
|
||||
return StringInit::get(LHSi->getAsString());
|
||||
} else if (isa<RecordRecTy>(getType())) {
|
||||
if (StringInit *Name = dyn_cast<StringInit>(LHS)) {
|
||||
if (!CurRec && !IsFinal)
|
||||
break;
|
||||
assert(CurRec && "NULL pointer");
|
||||
Record *D;
|
||||
|
||||
|
23
test/TableGen/cast-multiclass.td
Normal file
23
test/TableGen/cast-multiclass.td
Normal file
@ -0,0 +1,23 @@
|
||||
// RUN: llvm-tblgen %s | FileCheck %s
|
||||
|
||||
class AClass<bit C> {
|
||||
bit Cond = C;
|
||||
}
|
||||
|
||||
def A0: AClass<0>;
|
||||
def A1: AClass<1>;
|
||||
|
||||
class BoolToList<bit Value> {
|
||||
list<int> ret = !if(Value, [1]<int>, []<int>);
|
||||
}
|
||||
|
||||
multiclass P<string AStr> {
|
||||
foreach i = BoolToList<!cast<AClass>(AStr).Cond>.ret in
|
||||
def SubDef;
|
||||
}
|
||||
|
||||
// CHECK-NOT: def XSubDef
|
||||
defm X : P<"A0">;
|
||||
|
||||
// CHECK: def YSubDef
|
||||
defm Y : P<"A1">;
|
Loading…
x
Reference in New Issue
Block a user