gccrs: Add privacy checks
commitca246e573fb3f53fba5794f72b9245382eb46180
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 23 Aug 2022 15:32:26 +0000 (23 16:32 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 13 Dec 2022 13:00:06 +0000 (13 14:00 +0100)
tree106c5834069c035ac3799ea77014508a7b5dd475
parent5215235f01665062fbe182bb0c3c49539d882ad7
gccrs: Add privacy checks

This pass is responsible for resolving the privacy of items and verifying
that access to these items is performed within the limits of that privacy.
By default, items in Rust are private and only public to the current
module and its submodules. However, the user can annotate an item with
various qualifiers such as `pub` to publicly expose an item. Furthermore,
a module path can be given to `pub` to restrict an item's privacy to a
certain module: These paths need to be resolved and later on checked by
the privacy error reporter.

gcc/rust/
* checks/errors/privacy/rust-privacy-check.cc: New.
* checks/errors/privacy/rust-privacy-check.h: New.
* checks/errors/privacy/rust-privacy-common.h: New.
* checks/errors/privacy/rust-privacy-ctx.cc: New.
* checks/errors/privacy/rust-privacy-ctx.h: New.
* checks/errors/privacy/rust-privacy-reporter.cc: New.
* checks/errors/privacy/rust-privacy-reporter.h: New.
* checks/errors/privacy/rust-pub-restricted-visitor.cc: New.
* checks/errors/privacy/rust-pub-restricted-visitor.h: New.
* checks/errors/privacy/rust-reachability.cc: New.
* checks/errors/privacy/rust-reachability.h: New.
* checks/errors/privacy/rust-visibility-resolver.cc: New.
* checks/errors/privacy/rust-visibility-resolver.h: New.
13 files changed:
gcc/rust/checks/errors/privacy/rust-privacy-check.cc [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-privacy-check.h [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-privacy-common.h [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-privacy-ctx.cc [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-privacy-ctx.h [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-privacy-reporter.h [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.cc [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.h [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-reachability.cc [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-reachability.h [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-visibility-resolver.cc [new file with mode: 0644]
gcc/rust/checks/errors/privacy/rust-visibility-resolver.h [new file with mode: 0644]