aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Young <wenzhang5800@gmail.com>2021-07-09 09:09:26 +0800
committerThomas Young <wenzhang5800@gmail.com>2021-07-09 09:09:26 +0800
commitf3a345f0eb13e2b00324616e4784f76fa1f48ee7 (patch)
tree59c7c34485feb0eb0325f949853f526518880c55 /gcc
parente750295b6078c2c638822a4c32339301579bb05e (diff)
downloadgcc-f3a345f0eb13e2b00324616e4784f76fa1f48ee7.zip
gcc-f3a345f0eb13e2b00324616e4784f76fa1f48ee7.tar.gz
gcc-f3a345f0eb13e2b00324616e4784f76fa1f48ee7.tar.bz2
revert visit_path_segment return type to bool
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/lint/rust-lint-marklive.cc32
-rw-r--r--gcc/rust/lint/rust-lint-marklive.h2
2 files changed, 16 insertions, 18 deletions
diff --git a/gcc/rust/lint/rust-lint-marklive.cc b/gcc/rust/lint/rust-lint-marklive.cc
index 3d90a6b..f251b63 100644
--- a/gcc/rust/lint/rust-lint-marklive.cc
+++ b/gcc/rust/lint/rust-lint-marklive.cc
@@ -92,8 +92,7 @@ void
MarkLive::visit (HIR::PathInExpression &expr)
{
expr.iterate_path_segments ([&] (HIR::PathExprSegment &seg) -> bool {
- visit_path_segment (seg);
- return true;
+ return visit_path_segment (seg);
});
}
@@ -114,14 +113,13 @@ MarkLive::visit (HIR::MethodCallExpr &expr)
// node back to HIR
HirId ref;
- bool ret
- = mappings->lookup_node_to_hir (expr.get_mappings ().get_crate_num (),
- ref_node_id, &ref);
- rust_assert (ret);
+ bool ok = mappings->lookup_node_to_hir (expr.get_mappings ().get_crate_num (),
+ ref_node_id, &ref);
+ rust_assert (ok);
mark_hir_id (ref);
}
-void
+bool
MarkLive::visit_path_segment (HIR::PathExprSegment seg)
{
NodeId ast_node_id = seg.get_mappings ().get_nodeid ();
@@ -136,13 +134,14 @@ MarkLive::visit_path_segment (HIR::PathExprSegment seg)
}
else if (!resolver->lookup_resolved_type (ast_node_id, &ref_node_id))
{
- return;
+ return false;
}
HirId ref;
- bool ret = mappings->lookup_node_to_hir (seg.get_mappings ().get_crate_num (),
- ref_node_id, &ref);
- rust_assert (ret);
+ bool ok = mappings->lookup_node_to_hir (seg.get_mappings ().get_crate_num (),
+ ref_node_id, &ref);
+ rust_assert (ok);
mark_hir_id (ref);
+ return true;
}
void
@@ -195,10 +194,9 @@ MarkLive::visit (HIR::IdentifierExpr &expr)
// node back to HIR
HirId ref;
- bool ret
- = mappings->lookup_node_to_hir (expr.get_mappings ().get_crate_num (),
- ref_node_id, &ref);
- rust_assert (ret);
+ bool ok = mappings->lookup_node_to_hir (expr.get_mappings ().get_crate_num (),
+ ref_node_id, &ref);
+ rust_assert (ok);
mark_hir_id (ref);
}
@@ -209,10 +207,10 @@ MarkLive::visit (HIR::TypeAlias &alias)
resolver->lookup_resolved_type (
alias.get_type_aliased ()->get_mappings ().get_nodeid (), &ast_node_id);
HirId hir_id;
- bool ret
+ bool ok
= mappings->lookup_node_to_hir (alias.get_mappings ().get_crate_num (),
ast_node_id, &hir_id);
- rust_assert (ret);
+ rust_assert (ok);
mark_hir_id (hir_id);
}
diff --git a/gcc/rust/lint/rust-lint-marklive.h b/gcc/rust/lint/rust-lint-marklive.h
index 6a25779..e6ca4ae 100644
--- a/gcc/rust/lint/rust-lint-marklive.h
+++ b/gcc/rust/lint/rust-lint-marklive.h
@@ -266,7 +266,7 @@ private:
tyctx (Resolver::TypeCheckContext::get ()){};
void mark_hir_id (HirId);
- void visit_path_segment (HIR::PathExprSegment);
+ bool visit_path_segment (HIR::PathExprSegment);
void find_ref_node_id (NodeId ast_node_id, NodeId &ref_node_id,
Location locus, const std::string &node_name);
};