Allow initializing variable initializers with variables

llvm-svn: 7354
This commit is contained in:
Chris Lattner 2003-07-28 03:39:57 +00:00
parent 09a63a80e2
commit 2c76692496
2 changed files with 11 additions and 1 deletions

View File

@ -127,6 +127,15 @@ Init *RecordRecTy::convertValue(DefInit *DI) {
return DI; return DI;
} }
Init *RecordRecTy::convertValue(TypedInit *VI) {
// Ensure that VI is compatible with Rec.
if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(VI->getType()))
if (RRT->getRecord()->isSubClassOf(getRecord()) ||
RRT->getRecord() == getRecord())
return VI;
return 0;
}
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Initializer implementations // Initializer implementations
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -137,6 +137,7 @@ public:
Init *convertValue(UnsetInit *UI) { return (Init*)UI; } Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue( DefInit *DI); Init *convertValue( DefInit *DI);
Init *convertValue(TypedInit *VI);
void print(std::ostream &OS) const; void print(std::ostream &OS) const;
}; };