aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-07-10 20:39:35 +0000
committerGitHub <noreply@github.com>2021-07-10 20:39:35 +0000
commitf090e7ca9fa0b19f1cd7df16a0476b6e252c5ef1 (patch)
treeb93cd60759e608f8314a481a86adf442809f9706
parent9a58a5c256b866e6f66eb3cfb3a9a199dad3e42d (diff)
parent458690323312f06c6e56f102edc6479fc7dcc9c0 (diff)
downloadgcc-f090e7ca9fa0b19f1cd7df16a0476b6e252c5ef1.zip
gcc-f090e7ca9fa0b19f1cd7df16a0476b6e252c5ef1.tar.gz
gcc-f090e7ca9fa0b19f1cd7df16a0476b6e252c5ef1.tar.bz2
Merge #558
558: Call MarkLive inside ScanDeadcode, then the pass entrance will be single in session::parse_file r=philberty a=thomasyonug Call MarkLive inside ScanDeadcode, then the pass entrance will be single in session::parse_file Co-authored-by: Thomas Young <wenzhang5800@gmail.com>
-rw-r--r--gcc/rust/lint/rust-lint-scan-deadcode.h5
-rw-r--r--gcc/rust/rust-session-manager.cc9
2 files changed, 4 insertions, 10 deletions
diff --git a/gcc/rust/lint/rust-lint-scan-deadcode.h b/gcc/rust/lint/rust-lint-scan-deadcode.h
index c50159f..1128818 100644
--- a/gcc/rust/lint/rust-lint-scan-deadcode.h
+++ b/gcc/rust/lint/rust-lint-scan-deadcode.h
@@ -22,7 +22,7 @@
#include <set>
#include "rust-hir-full-decls.h"
#include "rust-hir-map.h"
-#include "rust-lint-marklive-base.h"
+#include "rust-lint-marklive.h"
#include "rust-name-resolver.h"
#include "rust-diagnostics.h"
@@ -34,8 +34,9 @@ class ScanDeadcode : public MarkLiveBase
using Rust::Analysis::MarkLiveBase::visit;
public:
- static void Scan (HIR::Crate &crate, std::set<HirId> live_symbols)
+ static void Scan (HIR::Crate &crate)
{
+ std::set<HirId> live_symbols = Analysis::MarkLive::Analysis (crate);
ScanDeadcode sdc (live_symbols);
for (auto it = crate.items.begin (); it != crate.items.end (); it++)
{
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index eb77c07..504f308 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -49,7 +49,6 @@
#include "rust-ast-resolve.h"
#include "rust-ast-lower.h"
#include "rust-hir-type-check.h"
-#include "rust-lint-marklive.h"
#include "rust-lint-scan-deadcode.h"
#include "rust-tycheck-dump.h"
#include "rust-ast-resolve-unused.h"
@@ -575,14 +574,8 @@ Session::parse_file (const char *filename)
if (saw_errors ())
return;
- // liveness analysis
- std::set<HirId> live_symbols = Analysis::MarkLive::Analysis (hir);
-
- if (saw_errors ())
- return;
-
// scan dead code
- Analysis::ScanDeadcode::Scan (hir, live_symbols);
+ Analysis::ScanDeadcode::Scan (hir);
if (saw_errors ())
return;