aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Young <wenzhang5800@gmail.com>2021-06-15 10:26:49 +0800
committerThomas Young <wenzhang5800@gmail.com>2021-06-15 10:26:49 +0800
commitba9728b401879691c81b8315e97f82a7c72826c8 (patch)
treeedd550ab7d6d3c26c36603c8861d4e758649e4d4
parent59f8d7a2343cd326e905be618c820387cf13afb7 (diff)
downloadgcc-ba9728b401879691c81b8315e97f82a7c72826c8.zip
gcc-ba9728b401879691c81b8315e97f82a7c72826c8.tar.gz
gcc-ba9728b401879691c81b8315e97f82a7c72826c8.tar.bz2
replace analysis dir with lint dir and rename liveness to marklive
-rw-r--r--gcc/rust/Make-lang.in8
-rw-r--r--gcc/rust/lint/rust-lint-marklive-base.h (renamed from gcc/rust/analysis/rust-hir-liveness-base.h)11
-rw-r--r--gcc/rust/lint/rust-lint-marklive.cc (renamed from gcc/rust/analysis/rust-hir-liveness.cc)22
-rw-r--r--gcc/rust/lint/rust-lint-marklive.h (renamed from gcc/rust/analysis/rust-hir-liveness.h)10
-rw-r--r--gcc/rust/lint/rust-lint-scan-deadcode.h (renamed from gcc/rust/analysis/rust-hir-scan-deadcode.h)8
-rw-r--r--gcc/rust/rust-session-manager.cc6
6 files changed, 32 insertions, 33 deletions
diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in
index 9ba5457..794c7a3 100644
--- a/gcc/rust/Make-lang.in
+++ b/gcc/rust/Make-lang.in
@@ -80,7 +80,7 @@ GRS_OBJS = \
rust/rust-tyty.o \
rust/rust-tyctx.o \
rust/rust-hir-const-fold.o \
- rust/rust-hir-liveness.o \
+ rust/rust-lint-marklive.o \
$(END)
# removed object files from here
@@ -236,7 +236,7 @@ RUST_INCLUDES = -I $(srcdir)/rust \
-I $(srcdir)/rust/resolve \
-I $(srcdir)/rust/util \
-I $(srcdir)/rust/typecheck \
- -I $(srcdir)/rust/analysis
+ -I $(srcdir)/rust/lint
# add files that require cross-folder includes - currently rust-lang.o, rust-lex.o
CFLAGS-rust/rust-lang.o += $(RUST_INCLUDES)
@@ -297,8 +297,8 @@ rust/%.o: rust/typecheck/%.cc
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $<
$(POSTCOMPILE)
-# build rust/analysis files in rust folder
-rust/%.o: rust/analysis/%.cc
+# build rust/lint files in rust folder
+rust/%.o: rust/lint/%.cc
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $<
$(POSTCOMPILE)
diff --git a/gcc/rust/analysis/rust-hir-liveness-base.h b/gcc/rust/lint/rust-lint-marklive-base.h
index e8a1682..dda85a7 100644
--- a/gcc/rust/analysis/rust-hir-liveness-base.h
+++ b/gcc/rust/lint/rust-lint-marklive-base.h
@@ -20,19 +20,18 @@
#define RUST_HIR_LIVENESS_BASE
#include "rust-diagnostics.h"
-#include "rust-hir-liveness.h"
-#include "rust-hir-liveness-base.h"
+#include "rust-lint-marklive.h"
+#include "rust-lint-marklive-base.h"
#include "rust-hir-visitor.h"
#include "rust-hir-map.h"
namespace Rust {
namespace Analysis {
-class LivenessBase : public HIR::HIRVisitor
+class MarkLiveBase : public HIR::HIRVisitor
{
public:
- virtual ~LivenessBase () {}
-
+ virtual ~MarkLiveBase () {}
virtual void visit (HIR::IdentifierExpr &) override {}
virtual void visit (HIR::Lifetime &) override {}
virtual void visit (HIR::LifetimeParam &) override {}
@@ -197,7 +196,7 @@ public:
virtual void visit (HIR::BareFunctionType &) override {}
protected:
- LivenessBase () : mappings (Analysis::Mappings::get ()) {}
+ MarkLiveBase () : mappings (Analysis::Mappings::get ()) {}
Analysis::Mappings *mappings;
};
diff --git a/gcc/rust/analysis/rust-hir-liveness.cc b/gcc/rust/lint/rust-lint-marklive.cc
index e65c1eb..56e3cc5 100644
--- a/gcc/rust/analysis/rust-hir-liveness.cc
+++ b/gcc/rust/lint/rust-lint-marklive.cc
@@ -16,16 +16,16 @@
// along with GCC; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include "rust-hir-liveness.h"
+#include "rust-lint-marklive.h"
#include "rust-hir-full.h"
#include "rust-name-resolver.h"
namespace Rust {
namespace Analysis {
-class FindEntryPoint : public LivenessBase
+class FindEntryPoint : public MarkLiveBase
{
- using Rust::Analysis::LivenessBase::visit;
+ using Rust::Analysis::MarkLiveBase::visit;
public:
static std::vector<HirId> find (HIR::Crate &crate)
@@ -48,22 +48,22 @@ public:
}
private:
- FindEntryPoint () : LivenessBase () {}
+ FindEntryPoint () : MarkLiveBase () {}
std::vector<HirId> entryPoints;
std::vector<HirId> getEntryPoint () { return entryPoints; }
};
std::set<HirId>
-Liveness::Analysis (HIR::Crate &crate)
+MarkLive::Analysis (HIR::Crate &crate)
{
- Liveness liveness (FindEntryPoint::find (crate));
- liveness.go (crate);
+ MarkLive marklive (FindEntryPoint::find (crate));
+ marklive.go (crate);
- return liveness.liveSymbols;
+ return marklive.liveSymbols;
}
void
-Liveness::go (HIR::Crate &crate)
+MarkLive::go (HIR::Crate &crate)
{
CrateNum crateNum = crate.get_mappings ().get_crate_num ();
while (!worklist.empty ())
@@ -89,7 +89,7 @@ Liveness::go (HIR::Crate &crate)
}
void
-Liveness::visit (HIR::PathInExpression &expr)
+MarkLive::visit (HIR::PathInExpression &expr)
{
NodeId ast_node_id = expr.get_mappings ().get_nodeid ();
NodeId ref_node_id = UNKNOWN_NODEID;
@@ -119,7 +119,7 @@ Liveness::visit (HIR::PathInExpression &expr)
}
void
-Liveness::visit (HIR::IdentifierExpr &expr)
+MarkLive::visit (HIR::IdentifierExpr &expr)
{
NodeId ast_node_id = expr.get_mappings ().get_nodeid ();
diff --git a/gcc/rust/analysis/rust-hir-liveness.h b/gcc/rust/lint/rust-lint-marklive.h
index aa65991..abc1ed3 100644
--- a/gcc/rust/analysis/rust-hir-liveness.h
+++ b/gcc/rust/lint/rust-lint-marklive.h
@@ -19,18 +19,18 @@
#ifndef RUST_HIR_LIVENESS
#define RUST_HIR_LIVENESS
+#include <set>
#include "rust-hir-full-decls.h"
#include "rust-hir-map.h"
-#include "rust-hir-liveness-base.h"
+#include "rust-lint-marklive-base.h"
#include "rust-name-resolver.h"
-#include <set>
namespace Rust {
namespace Analysis {
-class Liveness : public LivenessBase
+class MarkLive : public MarkLiveBase
{
- using Rust::Analysis::LivenessBase::visit;
+ using Rust::Analysis::MarkLiveBase::visit;
public:
static std::set<HirId> Analysis (HIR::Crate &crate);
@@ -142,7 +142,7 @@ private:
std::set<HirId> scannedSymbols;
Analysis::Mappings *mappings;
Resolver::Resolver *resolver;
- Liveness (std::vector<HirId> worklist)
+ MarkLive (std::vector<HirId> worklist)
: worklist (worklist), mappings (Analysis::Mappings::get ()),
resolver (Resolver::Resolver::get ()){};
};
diff --git a/gcc/rust/analysis/rust-hir-scan-deadcode.h b/gcc/rust/lint/rust-lint-scan-deadcode.h
index 4c42245..10edbbc 100644
--- a/gcc/rust/analysis/rust-hir-scan-deadcode.h
+++ b/gcc/rust/lint/rust-lint-scan-deadcode.h
@@ -19,19 +19,19 @@
#ifndef RUST_HIR_SCAN_DEADCODE
#define RUST_HIR_SCAN_DEADCODE
+#include <set>
#include "rust-hir-full-decls.h"
#include "rust-hir-map.h"
-#include "rust-hir-liveness-base.h"
+#include "rust-lint-marklive-base.h"
#include "rust-name-resolver.h"
#include "rust-diagnostics.h"
-#include <set>
namespace Rust {
namespace Analysis {
-class ScanDeadcode : public LivenessBase
+class ScanDeadcode : public MarkLiveBase
{
- using Rust::Analysis::LivenessBase::visit;
+ using Rust::Analysis::MarkLiveBase::visit;
public:
static void Scan (HIR::Crate &crate, std::set<HirId> live_symbols)
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 14ef987..e1938fa 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -49,8 +49,8 @@
#include "rust-ast-resolve.h"
#include "rust-ast-lower.h"
#include "rust-hir-type-check.h"
-#include "rust-hir-liveness.h"
-#include "rust-hir-scan-deadcode.h"
+#include "rust-lint-marklive.h"
+#include "rust-lint-scan-deadcode.h"
#include "rust-tycheck-dump.h"
#include "rust-ast-resolve-unused.h"
#include "rust-hir-const-fold.h"
@@ -573,7 +573,7 @@ Session::parse_file (const char *filename)
}
// liveness analysis
- std::set<HirId> live_symbols = Analysis::Liveness::Analysis (hir);
+ std::set<HirId> live_symbols = Analysis::MarkLive::Analysis (hir);
if (saw_errors ())
return;