Skip to content

Commit

Permalink
Update Codegen_Xtensa::print_assignment() from #6195
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
steven-johnson committed Dec 15, 2021
1 parent d518030 commit 7e233f1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/CodeGen_Xtensa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7e233f1

Please sign in to comment.