Skip to content

Commit 16124bc

Browse files
committed
Fix local variable allocations for functions with prototypes
1 parent 78734ef commit 16124bc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mlir/cxx/mlir/codegen_declarations.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ void Codegen::DeclarationVisitor::allocateLocals(ScopeSymbol* block) {
160160
allocateLocals(nestedBlock);
161161
continue;
162162
}
163+
if (auto params = symbol_cast<FunctionParametersSymbol>(symbol)) {
164+
allocateLocals(params);
165+
continue;
166+
}
163167

164168
if (auto var = symbol_cast<VariableSymbol>(symbol)) {
165169
if (var->isStatic()) continue;
@@ -730,4 +734,4 @@ void Codegen::asmQualifier(AsmQualifierAST* ast) {}
730734
void Codegen::asmClobber(AsmClobberAST* ast) {}
731735

732736
void Codegen::asmGotoLabel(AsmGotoLabelAST* ast) {}
733-
} // namespace cxx
737+
} // namespace cxx

0 commit comments

Comments
 (0)