From b1bc81285574a7b2bca29a2e0cd76b60dcf56106 Mon Sep 17 00:00:00 2001 From: hailong Date: Tue, 7 May 2024 18:18:04 +0800 Subject: [PATCH] [ImportVerilog] Fix unknown name caused by local variables. --- lib/Conversion/ImportVerilog/Statements.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Conversion/ImportVerilog/Statements.cpp b/lib/Conversion/ImportVerilog/Statements.cpp index 6860af7ba282..b1b214490e4d 100644 --- a/lib/Conversion/ImportVerilog/Statements.cpp +++ b/lib/Conversion/ImportVerilog/Statements.cpp @@ -63,8 +63,11 @@ struct StmtVisitor { return failure(); } - builder.create(loc, type, - builder.getStringAttr(var.name), initial); + // Collect local temporary variables. + auto varOp = builder.create( + loc, type, builder.getStringAttr(var.name), initial); + context.valueSymbols.insertIntoScope(context.valueSymbols.getCurScope(), + &var, varOp); return success(); }