forked from OSchip/llvm-project
Fix assertion on `!eq(?, 0)`
Instead of asserting, emit a proper error message
This commit is contained in:
parent
9d37f5afac
commit
2c8ee5329b
|
@ -1180,7 +1180,13 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) {
|
|||
InitList.push_back(ParseValue(CurRec, ArgType));
|
||||
if (!InitList.back()) return nullptr;
|
||||
|
||||
RecTy *ListType = cast<TypedInit>(InitList.back())->getType();
|
||||
TypedInit *InitListBack = dyn_cast<TypedInit>(InitList.back());
|
||||
if (!InitListBack) {
|
||||
Error(OpLoc, Twine("expected value to be a typed value, got '" +
|
||||
InitList.back()->getAsString() + "'"));
|
||||
return nullptr;
|
||||
}
|
||||
RecTy *ListType = InitListBack->getType();
|
||||
if (!ArgType) {
|
||||
ArgType = ListType;
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: not llvm-tblgen %s 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: error: expected value to be a typed value, got '?'
|
||||
|
||||
def Z1 {
|
||||
// This one caused an assertion because the value was an UnsetInit
|
||||
// and !eq() can only accept TypedInit's.
|
||||
bit D = !if(!eq(?, 0), 1, 0);
|
||||
}
|
Loading…
Reference in New Issue