diff options
Diffstat (limited to 'gcc/rust/lint/rust-lint-scan-deadcode.h')
-rw-r--r-- | gcc/rust/lint/rust-lint-scan-deadcode.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/rust/lint/rust-lint-scan-deadcode.h b/gcc/rust/lint/rust-lint-scan-deadcode.h index 7bb166a..00114f2 100644 --- a/gcc/rust/lint/rust-lint-scan-deadcode.h +++ b/gcc/rust/lint/rust-lint-scan-deadcode.h @@ -81,9 +81,11 @@ public: HirId hirId = stct.get_mappings ().get_hirid (); if (should_warn (hirId)) { - rust_warning_at (stct.get_locus (), 0, - "struct is never constructed: %<%s%>", - stct.get_identifier ().c_str ()); + bool name_starts_underscore = stct.get_identifier ().at (0) == '_'; + if (!name_starts_underscore) + rust_warning_at (stct.get_locus (), 0, + "struct is never constructed: %<%s%>", + stct.get_identifier ().c_str ()); } else { @@ -124,6 +126,12 @@ public: } } + void visit (HIR::Module &mod) override + { + for (auto &item : mod.get_items ()) + item->accept_vis (*this); + } + private: std::set<HirId> live_symbols; Resolver::Resolver *resolver; |