diff options
author | Marc Poulhiès <dkm@kataplop.net> | 2023-06-30 00:44:52 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:49:30 +0100 |
commit | 11fbade585049d2ff2f51f66a1eb6106deaec619 (patch) | |
tree | 3bfd72fcf0ddd8976f381bfffd39e3ff54affbc3 /gcc/rust/hir/tree/rust-hir.h | |
parent | 0ee496d5dc105b1925af0366d72c91c4e5712b3c (diff) | |
download | gcc-11fbade585049d2ff2f51f66a1eb6106deaec619.zip gcc-11fbade585049d2ff2f51f66a1eb6106deaec619.tar.gz gcc-11fbade585049d2ff2f51f66a1eb6106deaec619.tar.bz2 |
gccrs: refactor: make crate.items private
Introduce Crate::get_items () and fixup all callers.
gcc/rust/ChangeLog:
* hir/tree/rust-hir.h (struct Crate): Rename struct into ...
(class Crate): ... class, and add get_items.
* backend/rust-compile.cc (CompileCrate::go): Adapt to visibility change of items.
* checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::go): Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::go): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::go): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::go): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::go): Likewise.
* checks/lints/rust-lint-marklive.cc (FindEntryPoint::find): Likewise.
* checks/lints/rust-lint-scan-deadcode.h (ScanDeadCode::Scan): Likewise.
* metadata/rust-export-metadata.cc (PublicInterface::gather_export_data): Likewise.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise.
* hir/rust-hir-dump.cc (CompileCrate::go): Likewise.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Diffstat (limited to 'gcc/rust/hir/tree/rust-hir.h')
-rw-r--r-- | gcc/rust/hir/tree/rust-hir.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h index 8b60d10..662cbc6 100644 --- a/gcc/rust/hir/tree/rust-hir.h +++ b/gcc/rust/hir/tree/rust-hir.h @@ -863,18 +863,18 @@ protected: }; // A crate HIR object - holds all the data for a single compilation unit -struct Crate : public WithInnerAttrs +class Crate : public WithInnerAttrs { // dodgy spacing required here /* TODO: is it better to have a vector of items here or a module (implicit * top-level one)? */ - std::vector<std::unique_ptr<Item> > items; + std::vector<std::unique_ptr<Item>> items; Analysis::NodeMapping mappings; public: // Constructor - Crate (std::vector<std::unique_ptr<Item> > items, AST::AttrVec inner_attrs, + Crate (std::vector<std::unique_ptr<Item>> items, AST::AttrVec inner_attrs, Analysis::NodeMapping mappings) : WithInnerAttrs (std::move (inner_attrs)), items (std::move (items)), mappings (mappings) @@ -912,6 +912,7 @@ public: std::string as_string () const; const Analysis::NodeMapping &get_mappings () const { return mappings; } + std::vector<std::unique_ptr<Item>> &get_items () { return items; } }; // Base path expression HIR node - abstract |