mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-03 02:53:06 +00:00
Allow initializing variable initializers with variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7354 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
699104633a
commit
ce3d64025b
@ -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;
|
||||
};
|
||||
|
@ -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…
x
Reference in New Issue
Block a user