forked from OSchip/llvm-project
TableGen: Add strict assertions to sanity check earlier type checking
Summary: Both of these errors should have been caught by type-checking during parsing. Change-Id: I891087936fd1a91d21bcda57c256e3edbe12b94d Reviewers: arsenm, craig.topper, tra, MartinO Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D43558 llvm-svn: 325800
This commit is contained in:
parent
8fb962c04e
commit
d9f0b07ff7
|
@ -1241,6 +1241,8 @@ public:
|
||||||
bool setValue(Init *V) {
|
bool setValue(Init *V) {
|
||||||
if (V) {
|
if (V) {
|
||||||
Value = V->convertInitializerTo(getType());
|
Value = V->convertInitializerTo(getType());
|
||||||
|
assert(!Value || !isa<TypedInit>(Value) ||
|
||||||
|
cast<TypedInit>(Value)->getType()->typeIsConvertibleTo(getType()));
|
||||||
return Value == nullptr;
|
return Value == nullptr;
|
||||||
}
|
}
|
||||||
Value = nullptr;
|
Value = nullptr;
|
||||||
|
|
|
@ -478,6 +478,9 @@ ListInit *ListInit::get(ArrayRef<Init *> Range, RecTy *EltTy) {
|
||||||
if (ListInit *I = ThePool.FindNodeOrInsertPos(ID, IP))
|
if (ListInit *I = ThePool.FindNodeOrInsertPos(ID, IP))
|
||||||
return I;
|
return I;
|
||||||
|
|
||||||
|
assert(Range.empty() || !isa<TypedInit>(Range[0]) ||
|
||||||
|
cast<TypedInit>(Range[0])->getType()->typeIsConvertibleTo(EltTy));
|
||||||
|
|
||||||
void *Mem = Allocator.Allocate(totalSizeToAlloc<Init *>(Range.size()),
|
void *Mem = Allocator.Allocate(totalSizeToAlloc<Init *>(Range.size()),
|
||||||
alignof(ListInit));
|
alignof(ListInit));
|
||||||
ListInit *I = new(Mem) ListInit(Range.size(), EltTy);
|
ListInit *I = new(Mem) ListInit(Range.size(), EltTy);
|
||||||
|
|
Loading…
Reference in New Issue