[ImportVerilog] Fix missing return on error

Add missing `return {};` lines when operand expressions of concats fail
to convert and return a null value.
This commit is contained in:
Fabian Schuiki 2025-04-07 20:24:24 -07:00
parent 2afb3cd064
commit 51a69bcd6c
1 changed files with 4 additions and 7 deletions

View File

@ -410,9 +410,9 @@ struct RvalueExprVisitor {
SmallVector<Value> operands; SmallVector<Value> operands;
for (auto *operand : expr.operands()) { for (auto *operand : expr.operands()) {
auto value = context.convertRvalueExpression(*operand); auto value = context.convertRvalueExpression(*operand);
if (!value)
continue;
value = context.convertToSimpleBitVector(value); value = context.convertToSimpleBitVector(value);
if (!value)
return {};
operands.push_back(value); operands.push_back(value);
} }
return builder.create<moore::ConcatOp>(loc, operands); return builder.create<moore::ConcatOp>(loc, operands);
@ -872,12 +872,9 @@ struct RvalueExprVisitor {
value = context.convertRvalueExpression(*stream.operand); value = context.convertRvalueExpression(*stream.operand);
} }
value = context.convertToSimpleBitVector(value);
if (!value) if (!value)
return {}; return {};
value = context.convertToSimpleBitVector(value);
if (!value) {
return {};
}
operands.push_back(value); operands.push_back(value);
} }
Value value; Value value;
@ -974,7 +971,7 @@ struct LvalueExprVisitor {
for (auto *operand : expr.operands()) { for (auto *operand : expr.operands()) {
auto value = context.convertLvalueExpression(*operand); auto value = context.convertLvalueExpression(*operand);
if (!value) if (!value)
continue; return {};
operands.push_back(value); operands.push_back(value);
} }
return builder.create<moore::ConcatRefOp>(loc, operands); return builder.create<moore::ConcatRefOp>(loc, operands);