From f1b36f9a71eb267f04b7bd3a32aca9bc69f71e97 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 30 Jul 2003 04:16:52 +0000 Subject: Allow passing lists through variables git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7407 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/Record.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'utils/TableGen/Record.cpp') diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 72c5a230e5..a54f8e238b 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -116,6 +116,14 @@ Init *ListRecTy::convertValue(ListInit *LI) { return LI; } +Init *ListRecTy::convertValue(TypedInit *TI) { + // Ensure that TI is compatible with our class. + if (ListRecTy *LRT = dynamic_cast(TI->getType())) + if (LRT->getElementClass() == getElementClass()) + return TI; + return 0; +} + void RecordRecTy::print(std::ostream &OS) const { OS << Rec->getName(); } @@ -127,12 +135,12 @@ Init *RecordRecTy::convertValue(DefInit *DI) { return DI; } -Init *RecordRecTy::convertValue(TypedInit *VI) { - // Ensure that VI is compatible with Rec. - if (RecordRecTy *RRT = dynamic_cast(VI->getType())) +Init *RecordRecTy::convertValue(TypedInit *TI) { + // Ensure that TI is compatible with Rec. + if (RecordRecTy *RRT = dynamic_cast(TI->getType())) if (RRT->getRecord()->isSubClassOf(getRecord()) || RRT->getRecord() == getRecord()) - return VI; + return TI; return 0; } -- cgit v1.2.3-70-g09d2