forked from OSchip/llvm-project
Allow initializing variable initializers with variables
llvm-svn: 7354
This commit is contained in:
parent
09a63a80e2
commit
2c76692496
|
@ -127,6 +127,15 @@ Init *RecordRecTy::convertValue(DefInit *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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -136,7 +136,8 @@ public:
|
|||
Record *getRecord() const { return Rec; }
|
||||
|
||||
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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue