Skip to content

Commit

Permalink
Fix compilation warning.
Browse files Browse the repository at this point in the history
We had the following errors:
```
possibly dangling reference to a temporary [-Wdangling-reference]
 537 |     for (auto name : selector.shape().names()) {
     |                                             ^
```
  • Loading branch information
floitsch committed May 17, 2024
1 parent 5946efe commit e35d72d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/compiler/dispatch_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ void DispatchTableBuilder::print_table() {
selector.shape().arity(),
selector.shape().total_block_count(),
selector.shape().named_block_count());
for (auto name : selector.shape().names()) {
auto names = selector.shape().names();
for (auto name : names) {
printf(", %s", name.c_str());
}
auto id = selector_offsets().at(selector);
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/ir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,8 @@ class Printer : public Visitor {
node->shape().arity(),
node->shape().total_block_count(),
node->shape().named_block_count());
for (auto name : node->shape().names()) {
auto names = node->shape().names();
for (auto name : names) {
printf(", %s", name.c_str());
}
printf(") ");
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/no_such_method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ static void report_no_such_method(List<ir::Node*> candidates,
Map<Symbol, int> call_site_names; // The names that are used at the call site.

int index = 0;
for (auto symbol : selector.shape().names()) {
auto names = selector.shape().names();
for (auto symbol : names) {
call_site_names.set(symbol, selector.shape().is_block_name(index) ? BLOCK_NAME : NAME);
index++;
}
Expand Down

0 comments on commit e35d72d

Please sign in to comment.