From 7e233f1d229ac77bd6aad01c3a33f06abd0e1899 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 14 Dec 2021 18:16:34 -0800 Subject: [PATCH] Update Codegen_Xtensa::print_assignment() from #6195 Handles need to be `auto *` for the previous PR to work properly. (This should be refactored more intelligently to reduce code reuse; this is just a quick-fix to unbreak.) --- src/CodeGen_Xtensa.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/CodeGen_Xtensa.cpp b/src/CodeGen_Xtensa.cpp index cc8e6e8c745e..6eb3fcdc4c47 100644 --- a/src/CodeGen_Xtensa.cpp +++ b/src/CodeGen_Xtensa.cpp @@ -1973,7 +1973,14 @@ string CodeGen_Xtensa::print_assignment(Type t, const std::string &rhs) { auto cached = cache.find(rhs); if (cached == cache.end()) { id = unique_name('_'); - stream << get_indent() << print_type(t, AppendSpace) << (t.is_handle() ? " __restrict " : "") << (output_kind == CPlusPlusImplementation ? "const " : "") << id << " = " << rhs << ";\n"; + const char *const_flag = output_kind == CPlusPlusImplementation ? "const " : ""; + if (t.is_handle()) { + // Don't print void *, which might lose useful type information. just use auto. + stream << get_indent() << "auto * __restrict "; + } else { + stream << get_indent() << print_type(t, AppendSpace); + } + stream << const_flag << id << " = " << rhs << ";\n"; cache[rhs] = id; } else { id = cached->second;