aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Young <wenzhang5800@gmail.com>2021-07-10 09:26:13 +0800
committerThomas Young <wenzhang5800@gmail.com>2021-07-10 09:29:04 +0800
commit458690323312f06c6e56f102edc6479fc7dcc9c0 (patch)
treeb93cd60759e608f8314a481a86adf442809f9706 /gcc
parent9a58a5c256b866e6f66eb3cfb3a9a199dad3e42d (diff)
downloadgcc-458690323312f06c6e56f102edc6479fc7dcc9c0.zip
gcc-458690323312f06c6e56f102edc6479fc7dcc9c0.tar.gz
gcc-458690323312f06c6e56f102edc6479fc7dcc9c0.tar.bz2
call mark live symbols in ScanDeadcode instead of session::parse_file
Diffstat (limited to 'gcc')
-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;