Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
This allows for macro invocation at the toplevel or as statements. This
patched required us to propogate the delimited token tree fix to include
the delimiter tokens. The rest of the fix was straight forward to call
the apropriate visitors in names resolution and hir lowering.
Some thought will be needed to handle hir lowering for repeating items.
|
|
When we parse DelimTokenTree's the delimiter's are synthesised when we
ask for the token stream which results in tokens lacking location info.
This removes the hack by adding the actual tokens from the lexer into the
stream.
|
|
recursive macro expansion is required
|
|
This is the first pass at implementing macros more testcases are needed.
This does not support repetition matchers but it supports simple
declarative macros and transcribes them. The approach taken here is that
we reuse our existing parser to call the apropriate functions as specified
as part of the MacroFragmentType enum if the parser does not have errors
parsing that item then it must be a match.
Then once we match a rule we have a map of the token begin/end offsets
for each fragment match, this is then used to adjust and create a new token
stream for the macro rule definition so that when we feed it to the parser
the tokens are already substituted. The resulting expression or item is
then attached to the respective macro invocation and this is then name
resolved and used for hir lowering.
Fixes #17 #22
Addresses #573
|
|
|
|
|
|
|
|
935: frust-cfg: Only allow double quoted values r=philberty a=CohenArthur
Closes #910
This PR separates the `handle_cfg_option()` function in two, separating the parsing logic from the session logic. The parsing logic is able to be unit tested, and now only allows quoted values.
What remains to be done is to only allow `key` and `value` to be proper rust identifiers. We need to figure out if we'd like to spawn a parser here and parse identifiers, or simply sanitize both strings to make sure they do not contain invalid characters.
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
|
|
This commit separates the `handle_cfg_option()` function in two,
separating the parsing logic from the session logic. The parsing logic
is able to be unit tested, and now only allows quoted values.
|
|
|
|
|
|
934: macromatch: Add location to abstract MacroMatch class r=philberty a=CohenArthur
Closes #928
This adds location to the all child classes of the `MacroMatch` abstract class. The current locations are as follow, which I believe is what is expected but might be wrong.
```rust
test.rs:2:6: error: macro match fragment
2 | ($a:expr, $b:expr) => { $a + $b };
| ^
test.rs:2:15: error: macro match fragment
2 | ($a:expr, $b:expr) => { $a + $b };
| ^
test.rs:2:5: error: macro matcher
2 | ($a:expr, $b:expr) => { $a + $b };
| ^
test.rs:3:8: error: macro match fragment
3 | ($($i:ident)*) => { $($i)* }
| ^
test.rs:3:17: error: macro match repetition!
3 | ($($i:ident)*) => { $($i)* }
| ^
test.rs:3:5: error: macro matcher
3 | ($($i:ident)*) => { $($i)* }
| ^
```
I think this should be rebased on #932 so that I can remove the FIXME
937: dockerfile: Install cargo-gccrs alongside gccrs r=philberty a=CohenArthur
Closes #826
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
|
|
|
|
|
|
|
|
|
|
This maps over to DECL_UNINLINEABLE and to use the GCC attribute
always_inline.
Fixes #921
|
|
When we have method resolution we need to look at any deref lang items for
the receiver. The precise rules need to be tested rigorously to ensure this is right.
Fixes #890
|
|
|
|
|
|
|
|
|
|
This is a big cleanup so all paths that compile functions and constants
end up in the same path so we avoid any duplication in how we actually
compile a function.
|
|
|
|
|
|
We can reuse more C front-end code c_mark_addressable can be used instead
of trying to track TREE_ADDRESSABLE as part of type-checking. This also
pulls the GCC::Backend::address_expression to be part of the HIRCompileBase
class during code-generation.
|
|
This does a refactor by removing more flags for the fndecl construction
from the rust-gcc wrapper code in favour of using the tree api directly.
The ABI option attributes have also been refactored from the backend
interface in favour of their own package.
The gccgo wrapper tried to mark inline fns as extern inline but this
refactor allows us to control the inline options specificly for the
rust semantics.
Fixes #857
|
|
912: Handle generic substitution on path expressions r=philberty a=philberty
In this bug the path expression failed to take Foo::<i32> and apply this
bound generic argument into the impl block. The fn type for this function
test is:
fn <T,Y>test(a:T, b:Y);
But the impl block has a Self of Foo<T> so we need to inherit the T
argument from the previous Foo::<i32> which was missing.
Fixes #893
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
In this bug the path expression failed to take Foo::<i32> and apply this
bound generic argument into the impl block. The fn type for this function
test is:
fn <T,Y>test(a:T, b:Y);
But the impl block has a Self of Foo<T> so we need to inherit the T
argument from the previous Foo::<i32> which was missing.
Fixes #893
|
|
|
|
909: Add support for key = value pairs on -frust-cfg= r=philberty a=philberty
This adds in a basic parser to parse out key value pairs for the config
option it needs to be tested poperly once the self-test framework is
merged in.
Fixes #889
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
888: Added location data to Match Arm and removed unused code r=philberty a=mvvsmk
Fixes #863
- Added location data to Match arm in gcc/rust/ast/rust-expr.h and gcc/rust/hir/tree/rust-hir-expr.h
- Updated the respective constructors and copy constructors
- Updated location info for match arm in code generation in gcc/rust/backend/eust-compile-expr.cc
- Removed unused code in the above rust-expr.h and rust-gir-expr.h files as mentioned in the issue by `@philberty.`
- Comment removed form rust-expr.h
- Changed partameterized constructor and static function in
rust-hir-expr.h
- Changed line 697 to pass expr.get_locus() in rust-ast-lower
- Changed parameterised constructor in rust-expr.h
- Changed line 8563 in rust-parse-impl.h to pass location data.
Note :
- I also added a public member funtion for the class MatchArm
`Location get_locus ( ) const { return locus; }`
Do me know if I missed anything or could improve on something.
Signed-off-by : M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
Co-authored-by: @mvvsmk <mvvsmanojkumar@gmail.com>
|
|
908: Fix '-Wformat-diag' issue in 'TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)' r=philberty a=tschwinge
It's alread now diagnosed, non-fatal warning:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc: In member function ‘virtual void Rust::Resolver::TypeCheckPattern::visit(Rust::HIR::TupleStructPattern&)’:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc:61:69: warning: unquoted operator ‘::’ in format [-Wformat-diag]
61 | "expected tuple struct or tuple variant, found %s variant %s::%s",
| ^~
A later merge from GCC upstream will bring in
commit 34ba4275dcf5162efb9b634e4665734766faf4e3
"Enable -Werror=format-diag during bootstrap", which then causes:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc: In member function ‘virtual void Rust::Resolver::TypeCheckPattern::visit(Rust::HIR::TupleStructPattern&)’:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc:61:69: error: unquoted operator ‘::’ in format [-Werror=format-diag]
61 | "expected tuple struct or tuple variant, found %s variant %s::%s",
| ^~
cc1plus: all warnings being treated as errors
make[3]: *** [rust/rust-hir-type-check-pattern.o] Error 1
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
|
|
|
|
|
|
This adds in a basic parser to parse out key value pairs for the config
option it needs to be tested poperly once the self-test framework is
merged in.
Fixes #889
|
|
(HIR::TupleStructPattern &pattern)'
It's alread now diagnosed, non-fatal warning:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc: In member function ‘virtual void Rust::Resolver::TypeCheckPattern::visit(Rust::HIR::TupleStructPattern&)’:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc:61:69: warning: unquoted operator ‘::’ in format [-Wformat-diag]
61 | "expected tuple struct or tuple variant, found %s variant %s::%s",
| ^~
A later merge from GCC upstream will bring in
commit 34ba4275dcf5162efb9b634e4665734766faf4e3
"Enable -Werror=format-diag during bootstrap", which then causes:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc: In member function ‘virtual void Rust::Resolver::TypeCheckPattern::visit(Rust::HIR::TupleStructPattern&)’:
[...]/source-gcc/gcc/rust/typecheck/rust-hir-type-check-pattern.cc:61:69: error: unquoted operator ‘::’ in format [-Werror=format-diag]
61 | "expected tuple struct or tuple variant, found %s variant %s::%s",
| ^~
cc1plus: all warnings being treated as errors
make[3]: *** [rust/rust-hir-type-check-pattern.o] Error 1
|
|
907: Support cfg expansions predicates r=philberty a=philberty
Config expansion can be not, any, or all predicate to enforce the config
expansion logic.
This patch refactors the MacroParser to be named AttributeParser as it is
only used to parse attributes into MetaItems that we can work with and
do expansion logic upon. This handles the case of parsing the
inner-meta-item of not(A) to parse it into MetaListNameValueStr and tidies
up some of the code in the area.
Fixes #901
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
Addresses issue #863
1)comment removed form rust-expr.h
2)changed partameterized constructor and static function in
rust-hir-expr.h
3)changed line 697 to pass expr.get_locus() in rust-ast-lower
4)changed parameterised constructor in rust-expr.h
5)changed line 8563 in rust-parse-impl.h to pass location data.
Signed-off-by : M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
|
|
|
|
provisional one)"
To reduce the differences with GCC upstream, this reverts code formatting
changes of GCC/Rust commit ea5e2aff4e3fc149125bf5b7da627ffb352ced45, keeping
just the 'TARGET_RUST_CPU_INFO' definition.
|
|
906: GCC/Rust pieces of GCC upstream "Mass rename of C++ .c files to .cc suffix" r=tschwinge a=tschwinge
... in preparation of merge of the latter.
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
|
|
Config expansion can be not, any, or all predicate to enforce the config
expansion logic.
This patch refactors the MacroParser to be named AttributeParser as it is
only used to parse attributes into MetaItems that we can work with and
do expansion logic upon. This handles the case of parsing the
inner-meta-item of not(A) to parse it into MetaListNameValueStr and tidies
up some of the code in the area.
Fixes #901
|
|
903: Add new RustIdent struct to track canonical-path and location info r=philberty a=philberty
This refactors our TyTy type abstractions to contain their repspective
canonical-path and location info. This cleans up alot of location tracking
for example when we have generic structures we create implicit hirids which
may or may not have location info this now tracks the location info of
the declaration of the type avoiding any confustion.
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|